Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide or remove Action Bar on specific Activity | Android

Tags:

How I can remove Action Bar on specific activity not for all application, for example I have Sign Up activity and for this activity I want to remove Action Bar

like image 264
Maxim Avatar asked Jan 06 '17 17:01

Maxim


People also ask

How can remove action bar for specific activity in Android?

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 do I hide support action bar?

Hide the Status Bar on Android 4. getDecorView(); // Hide the status bar. // status bar is hidden, so hide that too if necessary. ActionBar actionBar = getActionBar();


2 Answers

In your AndroidManifest.xml use NoActionBar theme for your Activity like this:

<activity android:name=".SignUpActivity"           android:theme="@style/AppTheme.NoActionBar"/> 

and in your styles.xml

<style name="AppTheme.NoActionBar">     <item name="windowActionBar">false</item>     <item name="windowNoTitle">true</item> </style> 
like image 69
Yessine Mahdouani Avatar answered Sep 25 '22 12:09

Yessine Mahdouani


from within your activity:

getActionBar().hide(); 

or

getSupportActionBar().hide(); 

I would suggest to migrate to ToolBar, new Android API for the same purpose. The main benefit of ToolBar is that you can treat it like other views, it guarantees to you a more flexible approach.

like image 39
firegloves Avatar answered Sep 24 '22 12:09

firegloves