I want to hide the app title bar.
Asked
Active
Viewed 1.2e+01k times
3 Answers
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
-
1how can u also the hide the bar that shows the time and how many bars u have – ryan May 19 '10 at 03:36
-
The androidmanifest solution doesn't work for me. At least it isn't shown by code completion – Vincent Mar 31 '11 at 14:17
-
on tablet,this codes hidden option menu.how can solve it? – CooL i3oY Sep 08 '12 at 07:38
-
@Ciristian: if i use these codes,on tablet,like galaxy tab 7",buttons(buttom of table) is hidden!and user can not close program or see option menu!how to solve this? – CooL i3oY Sep 16 '12 at 04:16
-
@Ciristian: Not working in fragment class. What we need to do if using same. – AndroidHacker Nov 14 '13 at 09:41
-
It's not meant to be used in the fragment class, but in the activity class. – Cristian Nov 14 '13 at 21:30
-
@Cooli3oY one work around would be to override "onKeyDown" and check for "keyCode == KeyEvent.KEYCODE_MENU".. Then show your own custom menu with something like "AlertDialog" with a few "setItems" – Angry 84 Feb 03 '14 at 23:23
-
how to show back title? – user25 Feb 24 '19 at 21:52
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);
– Vitaliy A Aug 01 '14 at 12:18and than extend all your activites from this class.
-
1my 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