Search code examples
androidandroid-actionbarandroid-statusbar

How to hide Actionbar and not to hide statusbar(titlebar)?


Check the below image I need same things in my app. enter image description here I wanted to hide just actionbar not statusbar(titlebar). I use below code where both actionbar and statusbar hide.

<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>

Solution

  • By using this code, you can hide actionbar and statubar will remain in design.

    Just add this in your style.xml

      <style name="AppTheme.NooActionBar" parent="AppTheme">
            <item name="windowActionBar">false</item>
            <item name="windowNoTitle">true</item>
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
    

    add below code in your AndroidManifest.xml

     <activity
                android:name=".LoginActivity"
                android:theme="@style/AppTheme.NooActionBar" />