Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Action Bar remove

I'm trying to remove/disable the ActionBar. I tried to put in the Manifest:

<activity
    ...
    android:theme="@android:style/Theme.NoTitleBar"
</activity>

and it doesn't work. It doesn't remove the ActionBar. Please help me. Thanks.

like image 960
iYonatan Avatar asked Jul 14 '14 17:07

iYonatan


People also ask

How do I remove the action bar?

If you want to hide Action Bar from the entire application (from all Activities and fragments), then you can use this method. Just go to res -> values -> styles. xml and change the base application to “Theme. AppCompat.

How can remove action bar from single activity in Android?

If we want to remove the ActionBar only from specific activities, we can create a child theme with the AppTheme as it's parent, set windowActionBar to false and windowNoTitle to true and then apply this theme on an activity level by using the android:theme attribute in the AndroidManifest. xml file.


3 Answers

I had this issue too. I went to styles.xml and changed

parent="Theme.AppCompat.Light.DarkActionBar" 

to

parent="Theme.AppCompat.Light.NoActionBar"

and that removed it from all my activities.

like image 182
malamute84 Avatar answered Oct 19 '22 14:10

malamute84


in your oncreate() method use this

getActionBar().hide();

If your minSdkVersion is 10 or lower, instead use:

getSupportActionBar().hide();
like image 20
williamj949 Avatar answered Oct 19 '22 16:10

williamj949


You can try this. It works for me

Add it in style.xml

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
      <item name="windowActionBar">false</item>
      <item name="windowNoTitle">true</item>
      <item name="android:windowFullscreen">true</item>
</style>

and use the style at manifest.xml.

android:theme="@style/AppTheme.NoActionBar"
like image 14
reza.cse08 Avatar answered Oct 19 '22 15:10

reza.cse08