Remove ActionBar from Activity that extends appcompat-v7


Posted on : Fri, 24th Apr 15 10:16 am UTC
100+ votes

If you want to remove ActionBar from a particular Android Activity that extends ActionBarActivity from appcompat-v7 library then all you need to do is add the below to tags in the style.xml file,

<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>



Advertisements





    Example :

File : style.xml Language : xml
<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
       	<item name="android:windowActionBar">false</item>
    	<item name="android:windowNoTitle">true</item>
    </style>

</resources>

Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +