Prevent StatusBar from showing when using AlertDialog.Builder

前端 未结 5 805
半阙折子戏
半阙折子戏 2021-01-22 10:34

In the XML of my MainActivity, I have programmed it so that it uses a theme with NoActionBar and therefore there is no ac

5条回答
  •  有刺的猬
    2021-01-22 11:10

    I found a resource from the android official docs. So basically, for android version 4.1 and higher, use this code:

    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();
    

    PS: Source Link to official android doc

提交回复
热议问题