How can I make the status bar white with black icons?

前端 未结 7 784
野性不改
野性不改 2020-12-02 18:03

I want to change the colour of the status bar for my app so that it\'s white with black icons (instead of the default black with white icons). Is there any way of doing this

相关标签:
7条回答
  • 2020-12-02 18:48

    I had the same issue.

    I noticed that when I use normal layout like RelativeLayout it doesn't work. But when I switched to that come from support library like CordinatorLayout it has finally started to work. Try this.

      <?xml version="1.0" encoding="utf-8"?>
        <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            tools:context=".Activities.Activity">
    
    
            <android.support.v7.widget.Toolbar
                android:id="@+id/tb_activity"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:popupTheme="@style/AppTheme.PopupOverlay" />
    
    
        </android.support.design.widget.CoordinatorLayout>
    

    <********* BELOW OTHERS ATTRIBUTES ************>

    styles

    <resources>
    <!-- Base application theme. -->
    <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>
    
    <style name="AppTheme.NoActionBar" parent="AppTheme">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
    

    And in the manifest

    <activity
                android:name=".Activities.MyActivity"
                android:label="Activity"
                android:theme="@style/AppTheme.NoActionBar">
            </activity>
    
    0 讨论(0)
提交回复
热议问题