67

I want to hide the app title bar.

Cristian
  • 198,401
  • 62
  • 356
  • 264
ryan
  • 3,593
  • 4
  • 20
  • 12

3 Answers3

120

You can do it programatically:

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

Or you can do it via your AndroidManifest.xml file:

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

Edit: I added some lines so that you can show it in fullscreen, as it seems that's what you want.

Cristian
  • 198,401
  • 62
  • 356
  • 264
55

use

<activity android:name=".ActivityName" 
          android:theme="@android:style/Theme.NoTitleBar">
Vitaliy A
  • 3,651
  • 1
  • 32
  • 34
  • we should put it in every activity tag? Is there any shortcut for that @VitaliyA? – gumuruh Jul 31 '14 at 11:53
  • To @Gumuruh: You also can create some ActivityWithoutTitle class that exdend Activity and put in onCreate() folloving line:
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    
    and than extend all your activites from this class.
    – Vitaliy A Aug 01 '14 at 12:18
  • 1
    my application theme is `@style/Theme.AppCompat` so it wouldn't let me use `@android:style/Theme.NoTitleBar` for the activity theme. i used `@style/Theme.AppCompat.NoActionBar` for the activity theme instead, and it worked like a charm. – omikes Mar 22 '19 at 17:20
18

You can do it programatically: Or without action bar

//It's enough to remove the line
     requestWindowFeature(Window.FEATURE_NO_TITLE);

//But if you want to display  full screen (without action bar) write too

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

     setContentView(R.layout.your_activity);
chaon
  • 633
  • 6
  • 18