Where is API call to do “lights out mode” in honey

2019-01-17 02:12发布

问题:

I am working on a game and would like to have the full screen to itself.

Did anyone found a way to make the app go full screen on Android Honeycomb preview emulator?

回答1:

Lights out mode has changed in the full 3.0 SDK. You can now enter lights out mode as follows:

View v = findViewById(R.id.view_id);
v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);

You can also set a listener on the view to be notified on changes to the system bar's visibility.



回答2:

In prior versions of Android you can set the application to a full screen mode using this line in the manifest:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen".

I can't say for sure that works in 2.3, since I haven't done anything with 2.3 yet.

Secondly, I'm not too familiar with the term "lights out mode" but you can adjust the screen brightness using the WindowManager.LayoutParams class and the screenBrightness field.



回答3:

Two things I can add:

  1. My ListActivity hides the status bar, but when it pops up a progress dialog the status bar shows for as long as the progress dialog is displayed. The following reduced it to a brief flash, and applies to all dialogs done via "showDialog". I can't get rid of it entirely yet.

    protected void onPrepareDialog (int id, Dialog dialog) {
        View main_layout = dialog.findViewById(android.R.id.content).getRootView();
        main_layout.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
    }
    

    CAVEAT: "onPrepareDialog" is deprecated...

  2. As shown in the snippet above, you can get the root view's ID without defining an explicit ID in the parent layout in the xml layout file, which makes this a one-file edit.