Pages

Monday 17 February 2014

Hide TitleBar in android

When you developing application some times Title Bar is looking awkward, so we have to remove it.Title bar will represents that what activity is running.

To remove TitleBar single line code we have to use withinonCreate method.


Syntax:

requestWindowFeature(Window.FEATURE_NO_TITLE);
 

Show your application in the Mode of FullScreen

Use setFlags to show your application in fullscreen.

Syntax:

this.getWindow().setFlags(flags, mask);
 

Full Code:

@Override
protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
  //to hide TitleBar
  requestWindowFeature(Window.FEATURE_NO_TITLE);

//for FULL SCREEN  
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
  
  setContentView(R.layout.activity_main);
 }
 

Output:


No comments:

Post a Comment

Search Form