Posted By

chrisaiv on 09/29/11


Tagged

android


Versions (?)

Android: Remove title/notifications bar programmatically


 / Published in: Java
 

URL: http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme

There are roughly three ways to do this: programatically, through stylesheets, or through the Anroid manifest.

  1. public class MainActivity extends Activity {
  2. /** Called when the activity is first created. */
  3. @Override
  4. public void onCreate(Bundle savedInstanceState) {
  5. super.onCreate(savedInstanceState);
  6. setContentView(R.layout.main);
  7.  
  8. //Remove title bar
  9. this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  10.  
  11. //Remove notification bar
  12. this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  13.  
  14. }
  15. }

Report this snippet  

You need to login to post a comment.