0
我需要帶有操作欄的全屏應用程序。以下方法可以隱藏通知欄(包含batteri,rssi,警告等的欄)和導航欄(包含後退,主頁,正在運行的應用程序列表)。但導航欄下的區域仍然無法使用。帶標題欄的FullScreen活動(導航欄下的區域不可用!)
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoSystemBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowFullscreen">true</item>
</style>
和:
我從以下職位
- https://stackoverflow.com/a/27313442/3990512
- Is there a theme for Holo, full screen but with Action Bar?
以及測試思路
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
正如我所說的,undes導航欄面積不可用