Friday, March 22, 2013

Android: Full Screen & No title/action bar example

No Action bar:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);
Caution: this code has to be written BEFORE setContentView(...); or it will crash!

Full Screen:
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);


@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView(R.layout.layout_main);

}

No comments:

Post a Comment