Android: how to hide ActionBar on certain activities

后端 未结 16 1834
遇见更好的自我
遇见更好的自我 2020-11-29 17:58

I\'ve developed a simple demo application with a splash screen a map and some regular screens.

I have an action bar at the top that contains a logo. It all looks fin

相关标签:
16条回答
  • 2020-11-29 18:13

    Check for padding attribute if the issue still exists after changing theme.

    Padding Issue creating a white space on top of fragment window / app window

    Padding Issue creating a white space on top of fragment window / app window

    Once you remove the padding - top value automatically the white space is removed.

    0 讨论(0)
  • 2020-11-29 18:14

    Apply the following in your Theme for the Activity in AndroidManifest.xml:

    <activity android:name=".DashboardActivity"
            android:theme="@style/AppFullScreenTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
    
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    

    Then Apply the following in your Style in style.xml

    <style name="AppFullScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>
    
    0 讨论(0)
  • 2020-11-29 18:15

    // Hide the ActionBar on top

    // Add this code into java file

        ActionBar actionBar=getSupportActionBar();
        actionBar.hide();
    
    0 讨论(0)
  • 2020-11-29 18:17

    1.Go to your manifest.xml file.

    2.Find the activity tag for which you want to hide your ActionBar and then add ,

    android:theme="@style/Theme.AppCompat.NoActionBar"

               <activity
                android:name=".MainActivity"
                android:theme="@style/Theme.AppCompat.NoActionBar"
                >
    
    0 讨论(0)
  • 2020-11-29 18:19

    If you want to get full screen without actionBar and Title.

    Add it in style.xml

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

    and use the style at activity of manifest.xml.

    <activity ....
          android:theme="@style/AppTheme.NoActionBar" > ......
    </activity> 
    
    0 讨论(0)
  • 2020-11-29 18:20

    Replace AndroidManifest.xml

    android:theme="@style/FullscreenTheme"
    

    to

    android:theme="@style/Theme.Design.NoActionBar"
    
    0 讨论(0)
提交回复
热议问题