定義
在Android的說(shuō)法中,全屏模式(Full-screen mode)意味著從屏幕上刪除任何系統(tǒng)提供的“bars”:標(biāo)題欄(title bar),操作欄(action bar),狀態(tài)欄(status bar),系統(tǒng)欄(system bar),導(dǎo)航欄(navigation bar)等。您可以將其用于游戲,視頻播放器,數(shù)字 書籍閱讀者或其他在活動(dòng)中花費(fèi)的時(shí)間足夠大的地方,可以取消一些正常的配額,以釋放任何活動(dòng)本身所在的空間
在Android說(shuō)明中,點(diǎn)亮模式(Lights-out mode)是您使用系統(tǒng)欄(system bar)或?qū)Ш綑?navigation bar)的位置,并使其中的小部件變暗,使得該欄仍然可用,但視覺(jué)分散程度較低。 這是一個(gè)在Android 3.0中添加的新概念,在Android 1.x或2.x中沒(méi)有直接模擬。
Android 1.x/2.x
To have an activity be in full-screen mode, you have two choices:
- 使用Theme.NoTitleBar.Fullscreen的主題(或從Theme.NoTitleBar.Fullscreen繼承的一些自定義主題
- 在調(diào)用setContentView()之前,onCreate()中執(zhí)行以下語(yǔ)句:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
The first statement removes the title bar or action bar.
The second statement indicates that you want the activity to run in full-screen mode, hiding the status bar.
Android 4.0+

Lights-out, or low-profile mode, is achieved by calling setSystemUiVisibility() with the View.SYSTEM_UI_FLAG_LOW_PROFILE flag. This will dim the navigation or system bar, so the bar is there and the buttons are still active, but that they are less visually intrusive:

You can temporarily hide the navigation bar (or system bar) by passing View.SYSTEM_UI_FLAG_HIDE_NAVIGATION to setSystemUiVisibility(). The bar will disappear, until the user touches the UI, in which case the bar reappears:

Similarly, you can hide the status bar by passing View.SYSTEM_UI_FLAG_FULLSCREEN to setSystemUiVisibility(). However, despite this flag’s name, it does not affect the navigation or system bar:

Hence, to hide both the status bar and the navigation or system bar, you need to pass both flags (View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION):
