Search code examples
androidxmlandroid-actionbargraphical-layout-editor

Android graphical layout has a default actionbar shown in some cases


In the xml graphical layout of my android application there is a actionbar shown in one of my android studio projects and not in others. Out of curiosity i would like to know the reason behind this. I don't see any changes in the themes of either of the layouts and activities.

Something like this is shown : enter image description here

PS: the part above the dotted line is the actionbar. I want it removed somehow. It's not there in any of my other Android Studio projects.


Solution

  • Try adding this in your styles.xml

    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    
    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    

    and add AppTheme.NoAction to your activity in Manifest