How to hide Title and set Fullscreen mode in Android

To hide the activity view title programmatically, insert the following line in the onCreate method of the main activity:

requestWindowFeature(Window.FEATURE_NO_TITLE);

To set fullscreen mode, add this one:

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

The onCreate method would look like:

@Override
public 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.main);
}
Share Button

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.