Hiding the Status Bar

WMS->窗口管理statusbar和navbar管理 要想读懂窗口布局管理,必须了解status bar 和nav bar ,要了解这两个bar 更要了解相关的flags,下面就会这些flags做一些说明 View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR  //高亮状态栏 View.STATUS_BAR_TRANSLUCENT //半透明状态栏 View.STATUS_BAR_TRANSPARENT //透明状态栏,一... 阅读详情

This lesson describes how to hide the status bar on different versions of Android. Hiding the status bar (and optionally, the navigation bar) lets the content use more of the display space, thereby providing a more immersive user experience.

Figure 1 shows an app with a visible status bar:

system bars

Figure 1. Visible status bar.

Figure 2 shows an app with a hidden status bar. Note that the action bar is hidden too. You should never show the action bar without the status bar.

system bars

Figure 2. Hidden status bar.

Hide the Status Bar on Android 4.0 and Lower


You can hide the status bar on Android 4.0 (API level 14) and lower by setting WindowManager flags. You can do this programmatically or by setting an activity theme in your app's manifest file. Setting an activity theme in your app's manifest file is the preferred approach if the status bar should always remain hidden in your app (though strictly speaking, you could programmatically override the theme if you wanted to). For example:

<application
    ...
    android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
    ...
</application>

The advantages of using an activity theme are as follows:

  • It's easier to maintain and less error-prone than setting a flag programmatically.
  • It results in smoother UI transitions, because the system has the information it needs to render your UI before instantiating your app's main activity.

Alternatively, you can programmatically set WindowManager flags. This approach makes it easier to hide and show the status bar as the user interacts with your app:

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // If the Android version is lower than Jellybean, use this call to hide
        // the status bar.
        if (Build.VERSION.SDK_INT < 16) {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
        setContentView(R.layout.activity_main);
    }
    ...
}

When you set WindowManager flags (whether through an activity theme or programmatically), the flags remain in effect unless your app clears them.

You can use FLAG_LAYOUT_IN_SCREEN to set your activity layout to use the same screen area that's available when you've enabled FLAG_FULLSCREEN. This prevents your content from resizing when the status bar hides and shows.

Hide the Status Bar on Android 4.1 and Higher


You can hide the status bar on Android 4.1 (API level 16) and higher by using setSystemUiVisibility().setSystemUiVisibility() sets UI flags at the individual view level; these settings are aggregated to the window level. Using setSystemUiVisibility() to set UI flags gives you more granular control over the system bars than using WindowManager flags. This snippet hides the status bar:

View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();

Note the following:

  • Once UI flags have been cleared (for example, by navigating away from the activity), your app needs to reset them if you want to hide the bars again. See Responding 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 Status Bar


On Android 4.1 and higher, you can set your application's content to appear behind the status bar, so that the content doesn't resize as the status bar hides and shows. To do this, use SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN. 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 (for example, the built-in controls in a Maps application) don't end up getting covered by system bars. This could make your app unusable. In most cases you can handle this by adding the android:fitsSystemWindows attribute to your XML layout file, set to true. This adjusts the padding of the parent ViewGroup to leave space for the system windows. This is sufficient for most applications.

In some cases, however, you may need to modify the default padding to get the desired layout for your app. To directly manipulate how your content lays out relative to the system bars (which occupy a space known as the window's "content insets"), override fitSystemWindows(Rect insets). The fitSystemWindows() method is called by the view hierarchy when the content insets for a window have changed, to allow the window to adjust its content accordingly. By overriding this method you can handle the insets (and hence your app's layout) however you want.

Synchronize the Status Bar with Action Bar Transition


On Android 4.1 and higher, to avoid resizing your layout when the action bar hides and shows, you can enable overlay mode for the action bar. When in overlay mode, your activity layout uses all the space available as if the action bar is not there and the system draws the action bar in front of your layout. This obscures some of the layout at the top, but now when the action bar hides or appears, the system does not need to resize your layout and the transition is seamless.

To enable overlay mode for the action bar, you need to create a custom theme that extends an existing theme with an action bar and set the android:windowActionBarOverlay attribute to true. For more discussion of this topic, see Overlaying the Action Bar in the Adding the Action Bar class.

Then use SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, as described above, to set your activity layout to use the same screen area that's available when you've enabled SYSTEM_UI_FLAG_FULLSCREEN. When you want to hide the system UI, use SYSTEM_UI_FLAG_FULLSCREEN. This also hides the action bar (becausewindowActionBarOverlay=”true”) and does so with a coordinated animation when both hiding and showing the two.

WAM-202601:LingBot-VA(用于机器人控制的因果世界建模)【自回归扩散框架:利用双流MoT架构将视频与动作统一到单个交错序列中(先预测视频再逆动力解动作)】【基于Wan2.2-5B】 Causal World Modeling for Robot Control用于机器人控制的因果世界建模摘要This work highlights that video world modeling, alongside vision-language pre-training, establishes a fresh and independent foundation for robot learning. Intuitively, video world models provide the ab 阅读详情

相关推荐

SystemUI 如何判断当前界面显示的为全屏界面?

不积跬步无以至千里 一.前摘 怎么判断当前的用户处于全屏模式呢?处于全屏模式当中即是状态栏处于沉浸状态,而往往此时用户其实是不想被打扰的。因此可以针对当前如果用户处于全屏模式下,我们做一些勿扰模式的一种行为,类似于当处于全屏模式我们就不再弹出全屏通知等等。 二.正文 现在我们判断全屏模式肯定是因为状态栏的沉浸式出现的,因此我们就以此为突破口,查看SystemUI的源码中怎么控制状态栏的消失的? 代码路径: app/src/com/android/systemui/statu...

Older_Fisher的博客 717

Android - Hide the status bar

文章目录Hide the status barHide the Status Bar on Android 4.1 and HigherMake Content Appear Behind the Status Bar准备项目参考 Hide the status bar This lesson describes how to hide the status bar on different versions of Android. Hiding the status bar (and optionally

qq_29761395的博客 1007

【信息科学与工程学】【通信工程】第一百九十一篇 路由器体系结构03

编号类型领域问题详细的数学分析(逐步推理)参数列表(表达式 / 数值范围 / 边界 / 测量)关联知识839DCI演进 · 收敛DCI 2030 年三大技术收敛方向步骤1:方向一:IPoDWDM 成为绝对主流(Omdia 2027 59% → 2030 80%+),OTN 退化为 OLS 纯光层。步骤2:方向二:800ZR+ 取代 400ZR 成为主力速率,PCS 使 800G 达 600–1000km。步骤3:方向三:AI 集群 DCI 催生 1.6T/3.2T 超短距(<10km)相干模块(OSFP-X

weixin_49199313的博客 915

Android全屏显示问题 去掉系统标题栏 去掉系统菜单栏相关记录

全屏显示在开发中常常会遇到,根据需求直接去掉标题栏即可。但今天在一个韩国客户那里发现很多机顶盒既然存在自带菜单栏的情况,看起来非常别扭,经过一番搜索后最后发现其实也不难,是你太悲观了。 去掉系统自动菜单栏 private void hideSystemUI() { // Enables regular immersive mode. // For "lean back...

挨T工作室的博客 424

东汉AD66年世界历史地图矢量文件SHP格式.zip

本资源为《东汉AD66年世界历史地图矢量文件SHP格式》压缩包,文件大小约 29.20 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见JSON 文件、属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

YOLO26算法公共场所人群口罩佩戴状态目标检测+训练好的模型+191张数据集+pyqt可视化界面-sts

拉到底部可查看数据集可视化效果。YOLO26算法公共场所人群口罩佩戴状态目标检测+训练好的模型+191张数据集+pyqt可视化界面本资源由 sts 账号整理发布,标注齐全,开箱可训。

管理系统UI之二:隐藏Status Bar (Hiding the Status Bar)

本文将讲解如何在不同android版本中隐藏status bar,隐藏状态栏(或者是导航栏)可以让内容得到更多的展示空间,从而提供一个更加沉浸式的用户体验。 下图展示了status bar可见时app的样子: 下图展示了status bar隐藏之后app的样子,注意我们有意让actionbar也跟着不见了,我们认为,当status bar隐藏的时候,actionbar也应该是隐藏的。

创造晴天 1689

安全管理基于脱敏叙事法的演讲训练实践:化工企业安全会议中真实案例讲述对员工行为干预的效果研究

内容概要:本文是一位化名为龙川的化工企业安全总监在参加王堃阳《神奇魔法公众演说实战特训》后的学习感悟分享。他反思过去八年在安全会议上机械宣读制度却无法改变工人行为的问题,通过“脱敏演讲训练”学会了用真实、具体的故事触动人心。他在会议中讲述一位因未系安全带而受伤的操作工的真实经历,包括其家庭状况与后续影响,显著提升了员工的关注度与安全意识。此后,他将安全会改革为“一个案例、三条动作、一次现场演示”的模式,并推动各车间主任每月讲述身边真实人物的安全故事,杜绝空洞说教。配合在更衣室张贴无评论式事故照片等举措,实现了全年零重伤、事故率五年最低的成果。作者提出“制度管行为,故事管人心”的理念,强调情感共鸣对安全管理的重要性。; 适合人群:企业安全管理人员、基层管理者、培训讲师及需要提升公众表达与影响力的相关从业者;; 使用场景及目标:①改善传统安全教育中“念制度无效”的困境;②提升员工参与度与安全行为自觉性;③学习如何通过真实故事构建共情,增强信息传递效果; 阅读建议:此材料不仅适用于安全管理领域,也可作为沟通表达、组织文化建设的参考案例,建议结合实际工作场景尝试“讲一个人”的方法,并注重真实性、情感投入与持续迭代,避免流于形式。

iPhone SDK Tip & Trick:Hiding/Showing Status Bar

Question: How do I hide/show the status bar? Answer: [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]];

395

(SMO滑膜+高频脉振方波注入法)FOC矢量控制永磁同步电机全速域无位置传感器控制(Simulink仿真实现)

(SMO滑膜+高频脉振方波注入法)FOC矢量控制永磁同步电机全速域无位置传感器控制(Simulink仿真实现)内容概要:本文详细介绍了基于SMO滑模控制与高频脉振方波注入法相结合的FOC矢量控制策略,用于实现永磁同步电机在全速域范围内的无位置传感器控制,并通过Simulink进行仿真实现。该方法在高速段采用滑模观测器(SMO)估算转子位置与速度,在零低速段引入高频方波注入法进行初始位置检测与定位,有效解决了传统传感器成本高、易损坏的问题,实现了全速域下高精度、强鲁棒性的电机控制。文中涵盖了控制系统结构设计、核心算法原理、关键模块建模及仿真结果分析,展示了两种方法的无缝切换机制与整体控制性能。; 适合人群:具备电机控制、电力电子与自动控制理论基础,从事电机驱动系统研发的研究生或工程技术人员。; 使用场景及目标:①应用于无人机、电动汽车、工业伺服等对体积、可靠性要求高的永磁同步电机驱动系统中;②目标是掌握无位置传感器控制的核心算法设计与Simulink建模仿真方法,提升全速域控制性能与系统集成度。; 阅读建议:建议结合Simulink模型同步调试,重点关注滑模观测器的设计、高频注入信号的解调与位置估计逻辑,以及不同速度区间下的切换策略,深入理解算法实现细节与参数整定方法。

定时器(PWM输出)触发ADC采样(DMA)——STM32CubeMX

已知 Tclk 为 84MHz , 我们需要 Tout 为 200ms 即 200000us , 不妨先让PSC为 839, 带入上述公式可得 ARR = 19999. 这样算出来之后ARR和PSC都在0~65535的范围, 则可以使用这组参数。例如,如果时钟频率为1MHz,并且PSC设置为1000,则实际的定时频率将为1kHz。当重装载值(Period 或 ARR)设置为 500 时,意味着定时器需要计数 500 个时钟周期才会触发中断。例如,如果时钟频率为1MHz,则Tclk为1微秒。

2301_77123899的博客 1万+

Android 12 S WindowManager解读之从dumpsys window windows看window

();;();;();执行adb shell dumpsys window windows 如下:rootTaskId=1(根Taskid) mSession=Session{e98843e 2512:u0a10120} mClient=android.os.BinderProxy@64c3da9appop=NONEmcc?mcc?

weixin_41028555的博客 4887

Maxwell涡流热损计算:铜导体在50Hz交流下的仿真实践

本文详细介绍了使用Maxwell软件进行铜导体在50Hz交流条件下的涡流热损仿真实践。从涡流热损的基本概念到Maxwell仿真设置、网格划分、结果后处理等关键步骤,提供了实用技巧和常见问题解决方案,帮助工程师准确计算涡流热损,优化电力设备设计。

weixin_42526015的博客 397

C++接口继承与实现继承:从设计意图到实战应用

在面向对象编程中,继承是实现代码复用和多态性的核心机制。C++通过虚函数、访问控制等语法特性,支持两种主要的设计模式:接口继承与实现继承。接口继承侧重于定义行为契约,通常使用纯虚函数和抽象基类来实现,它强制子类提供特定功能的实现,是实现多态和构建灵活框架的基础。实现继承则侧重于代码复用,通过非纯虚函数提供默认行为,子类可选择性地重写或扩展,常用于模板方法等设计模式,能有效减少重复代码。理解这两种继承方式的技术价值,有助于设计出低耦合、高内聚的类层次结构,在插件系统、算法框架、业务模块等应用场景中做出更合理的

weixin_30825199的博客 547

树莓派作为Modbus服务器:pymodbus配置全记录

手把手教你用树莓派部署Modbus服务器,核心基于pymodbus实现数据通信与设备控制,涵盖配置步骤与常见问题,适合工业自动化场景应用。

weixin_42510201的博客 763

【unity】解决unity编译器安装中文汉化包失败

查看是否有Localization目录如果没有就进行创建,然后点击打开Localization把下载的zh-hans.po文件复制剪切进去即可。如果有的同学中文包安装失败,我们找到相应的编译器版本,点击在资源管理器中显示按钮,我们找到简体中文,复制downloadUrl后面的值到浏览器打开进行下载,点击Edtior language选择框,选择简体中文,等待加载。我们点击当前目录的上一级,进入编译器目录。返回在文件管理器中点击Editor目录。编译器启动后点击Edit[编辑]按钮。复制或者剪切下载的文件。

weixin_44959182的博客 8042
上一篇: Hiding the Navigation Bar
下一篇: 管理系统UI之二:隐藏Status Bar (Hiding the Status Bar)
sdvch
博客等级 码龄16年 360粉丝 31原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值