android:theme=“@android:style/Theme.NoTitleBar.Fullscreen” works on Application level but not at the activity level. Any clue?

后端 未结 5 1529
清歌不尽
清歌不尽 2020-12-05 11:37

I need to make one of my activities called MyNoStatusBarActivity.java a full-screen activity.

I have added in the Manifest :



        
5条回答
  •  遥遥无期
    2020-12-05 11:45

    This will do the trick:

    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
    
        requestWindowFeature(Window.FEATURE_NO_TITLE);
    
        getWindow().setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
        setContentView(R.layout.activity_main);
    }
    

提交回复
热议问题