Hiding the Navigation Bar

本文介绍了如何在Android 4.0及以上版本中隐藏导航栏和状态栏的方法,通过使用特定的标志位可以让应用的内容全屏显示,为用户提供更加沉浸式的体验。此外,还讨论了如何使内容显示在导航栏后面的技术。

This lesson describes how to hide the navigation bar, which was introduced in Android 4.0 (API level 14).

Even though this lesson focuses on hiding the navigation bar, you should design your app to hide the status bar at the same time, as described in Hiding the Status Bar. Hiding the navigation and status bars (while still keeping them readily accessible) lets the content use the entire display space, thereby providing a more immersive user experience.

system bars

Figure 1. Navigation bar.

Hide the Navigation Bar on 4.0 and Higher


You can hide the navigation bar on Android 4.0 and higher using the SYSTEM_UI_FLAG_HIDE_NAVIGATION flag. This snippet hides both the navigation bar and the status bar:

View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
              | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);

Note the following:

  • With this approach, touching anywhere on the screen causes the navigation bar (and status bar) to reappear and remain visible. The user interaction causes the flags to be be cleared.
  • Once the flags have been cleared, your app needs to reset them if you want to hide the bars again. SeeResponding to UI Visibility Changes for a discussion of how to listen for UI visibility changes so that your app can respond accordingly.
  • Where you set the UI flags makes a difference. If you hide the system bars in your activity's onCreate()method and the user presses Home, the system bars will reappear. When the user reopens the activity,onCreate() won't get called, so the system bars will remain visible. If you want system UI changes to persist as the user navigates in and out of your activity, set UI flags in onResume() or onWindowFocusChanged().
  • The method setSystemUiVisibility() only has an effect if the view you call it from is visible.
  • Navigating away from the view causes flags set with setSystemUiVisibility() to be cleared.

Make Content Appear Behind the Navigation Bar


On Android 4.1 and higher, you can set your application's content to appear behind the navigation bar, so that the content doesn't resize as the navigation bar hides and shows. To do this, useSYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION. You may also need to use SYSTEM_UI_FLAG_LAYOUT_STABLE to help your app maintain a stable layout.

When you use this approach, it becomes your responsibility to ensure that critical parts of your app's UI don't end up getting covered by system bars. For more discussion of this topic, see the Hiding the Status Bar lesson.

打开链接下载源码: https://pan.quark.cn/s/a4b39357ea24 HFSS,其全称为High Frequency Structure Simulator,是由Ansys公司研发的一款高级三维电磁场仿真软件,主要应用于射频、微波以及光学领域内的设计工作与性能分析。当前压缩包内提供的是一个基于HFSS软件构建的偶极子天线模型,并且包含了该模型的仿真数据,我们将对这一模型及其关联的学术知识进行细致的探讨。偶极子天线属于天线设计中最基础的类型之一,其结构由两个大小相等且布局对称的导体单元构成,整体形状类似于汉字“工”。在2.4GHz的频率条件下,此类天线被广泛部署于Wi-Fi、蓝牙等无线通信系统的构建中。HFSS软件能够对偶极子天线的电气特性进行高精度模拟,涵盖辐射模式、增益水平、方向图形态、输入阻抗以及S参数等多个核心指标。 S参数(即Scattering Parameters),是用于评估天线或微波器件输入端与输出端之间相互影响程度的关键参数。S参数详细刻画了信号流经网络设备时的反射与传输状态,其中S11(输入反射系数)和S21(传输系数)是最为常用的两种表征方式。借助HFSS软件执行S参数仿真,可以获取天线在多种频率下的反射与传输特性表现,从而协助设计人员对天线的阻抗匹配程度和运行效率进行有效评估。在此模型中,S参数仿真工作业已完成,因此我们可以直接审视2.4GHz频率下的阻抗匹配状况,以验证天线在该工作频段内能否展现出理想的性能。 在"Project1_1.aedt"与"Project1.aedt"这两个提供的文件中,储存了HFSS项目的完整信息。这些文件内含了天线的几何构造细节、材料物理属性、边界约束条件、求解器配置参数以及仿真获取的结果...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值