我已经编写了一个自定义的Action Bar。问题是,为了使用这个操作栏,我在清单中使用了我的自定义主题。我还想禁用StatusBar。我该怎么做?
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="colorPrimary">@color/red</item>
<item name="colorPrimaryDark">@color/red</item>
</style>
发布于 2016-06-08 01:40:03
首先,谷歌不鼓励这种行为,说:
您不应该在没有状态栏的情况下显示操作栏。
但是,如果您坚持这样做的话。试试下面这段代码:
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);摘自:https://developer.android.com/training/system-ui/status.html
https://stackoverflow.com/questions/37685684
复制相似问题