Search code examples
androidandroid-layoutlistviewandroid-studioandroid-developer-api

How to remove title bar in android api 22 and api 25?


I am using android studio 2.2.3. How can i remove title bar from my application? I am tried by putting

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
</activity>

in AndroidManifest.xml file but it doesn't worked.

Here is screenshot my project My Project

My Style.xml file code is

<style>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item> </style>

What should have to change in style.xml file?


Solution

  • Add this style in Style.xml

    <!-- Base application theme. -->
        <style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <!-- Customize your theme here. -->
    
        </style>
        <style name="AppTheme" parent="AppBaseTheme">
            - <!--  All customizations that are NOT specific to a particular API-level can go here.
      -->
            <item name="android:windowNoTitle">true</item>
            <item name="android:windowActionBar">false</item>
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>