mousik mousik - 4 days ago 6
Android Question

Delete / Hide / Remove Actionbar

I read about 20 topics and still didn't find a solution that worked for me.

I need to delete, hide, or remove the actionbar in my all activities.

Styles.xml (I tried Theme.AppCompat.NoActionBar and many, many more):

<style name="AppTheme" parent="Theme.AppCompat">

</style>


Dependencies

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.github.hotchemi:android-rate:1.0.1'
compile 'com.github.florent37:materialtextfield:1.0.5'
compile "com.android.support:support-core-utils:25.0.1"
}


Only Theme.AppCompat works (with actionbar), others shut down the application on start.

Answer

By Setting activity theme in manifest

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

or you can define your custom theme in styles.xml and set theme to your activity.

    <style name="AppTheme.FullScreen"          
    parent="Theme.AppCompat.Light.NoActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="colorPrimary">colorPrimary</item>
    <item name="colorPrimaryDark">colorPrimaryDark</item>
    <item name="colorAccent">colorAccent</item>
    <item name="android:windowActionBarOverlay">true</item>
    <item name="windowActionBarOverlay">true</item>
    <item name="colorControlNormal">@color/colorControlNormal</item>
    <item name="colorControlActivated">@color/colorControlActivated</item>
    <item name="colorControlHighlight">@color/colorControlHighlight</item>

</style>

and use this theme.

    <activity android:theme="@style/AppTheme.FullScreen"
                  ....>
Comments