-2

I want to remove this unwanted title bar

enter image description here

I cant remove this

i have tried

 this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
user8025
  • 99
  • 1
  • 9

3 Answers3

4

This is not a title bar. This is ActionBar or Toolbar. You should extend your application theme from Theme.AppCompat.NoActionBar. Or just add android:theme="@style/Theme.AppCompat.NoActionBar" to <application/> tag in AndroidManifest.xml

gildor
  • 1,789
  • 14
  • 19
1

add the following to your manifest:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

That should sort it, replace Theme with your actual theme if required, this line goes within the application part of the manifest or can go where the activity is declared.

apmartin1991
  • 3,064
  • 1
  • 23
  • 44
  • Gildors answer is better than mine, From your code I thought it as a TitleBar but Gildor believes it is an ActionBar or a ToolBar, please check out his answer :) – apmartin1991 May 15 '15 at 09:48
0

You need to set your content view AFTER you have written the two lines

//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

//set content view AFTER ABOVE sequence (to avoid crash)
this.setContentView(R.layout.layout_name); 
Bidhan
  • 10,607
  • 3
  • 39
  • 50