How to Disable Action Bar Permanently

How to disable action bar permanently

By setting activity theme in Manifest,

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

How to hide (or remove) Action Bar at run time in android application

If you are using the AppCompatActivity, then you can perform action:

// to hide the action bar
getSupportActionBar().hide();
// to show the action bar
getSupportActionBar().show();

If you are using the Activity, then you can perform action:

// to hide the action bar
getActionBar().hide();
// to show the action bar
getActionBar().show();

Note: This work only of You are using the Theme with Action Bar.

Android Studio - Action Bar remove

in your oncreate() method use this

getActionBar().hide();

If your minSdkVersion is 10 or lower, instead use:

getSupportActionBar().hide();

Android: how to hide ActionBar on certain activities

Apply the following in your Theme for the Activity in AndroidManifest.xml:

<activity android:name=".Activity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Android Activity without ActionBar

Haha, I have been stuck at that point a while ago as well, so I am glad I can help you out with a solution, that worked for me at least :)

What you want to do is define a new style within values/styles.xml so it looks like this

<resources>
<style name = "AppTheme" parent = "android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

<style name = "NoActionBar" parent = "@android:style/Theme.Holo.Light">
<item name = "android:windowActionBar">false</item>
<item name = "android:windowNoTitle">true</item>
</style>

</resources>

Only the NoActionBar style is intresting for you. At last you have to set is as your application's theme in the AndroidManifest.xml so it looks like this

<application
android:allowBackup = "true"
android:icon = "@drawable/ic_launcher"
android:label = "@string/app_name"
android:theme = "@style/NoActionBar" <!--This is the important line-->
>
<activity
[...]

I hope this helps, if not, let me know.



Related Topics



Leave a reply



Submit