Set full screen on page

Can I only set the My Activity action to Full Screen in the onCreate method (before setContentView)?

Is there a way I can set full screen outside of onCreate?

thanks

+8
android oncreate screen fullscreen
source share
5 answers

Maybe! Adding this code.

     // go full screen
     WindowManager.LayoutParams attrs = mActivity.getWindow (). GetAttributes ();
     attrs.flags | = WindowManager.LayoutParams.FLAG_FULLSCREEN;
     mActivity.getWindow (). setAttributes (attrs);

     // go non-full screen
     WindowManager.LayoutParams attrs = mActivity.getWindow (). GetAttributes ();
     attrs.flags & = (~ WindowManager.LayoutParams.FLAG_FULLSCREEN);
     mActivity.getWindow (). setAttributes (attrs);

+12
source share

The docs for Window.requestFeature read:

This must be called before setContentView ().

so no, I do not believe that there is another way to set the full screen after calling setContentView .

+1
source share
 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

Use this before setting up your layout. Because you are trying to customize the layout in full screen. Why do you need an external create method? ...

0
source share

Try the following:

 View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); 
0
source share
 @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); **requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);** setContentView(R.layout.activity); ... } 
-one
source share

All Articles