-1

I am using this code for hiding the title bar. Is there any other way of doing the same?

requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(
    WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);
Snekse
  • 15,474
  • 10
  • 62
  • 77
Programmer
  • 77
  • 1
  • 2
  • 10
  • http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme With XML like you want – marduc812 Oct 07 '14 at 19:51

2 Answers2

1

You can modify your manifest to use a theme that doesn't use a titlebar

<activity android:name=".MainActivity"
      android:label="@string/app_name"
      android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">

or you can specify a new style as done in this answer:

Community
  • 1
  • 1
RyPope
  • 2,645
  • 27
  • 51
1

For Api level 14 and above you can use

getActionBar().hide();

else for below api if you have to add v7 support library change Activity to ActionBarActivity

then you can just call

getSupportActionBar().hide();

This will give you full screen with notification bar

Suhail Mehta
  • 5,514
  • 2
  • 23
  • 37