These two icons(drawerlayout and menu icon) in toolbar is black, How to turn it into white?

时间:2017-08-05 12:22:27

标签: java android xml android-layout toolbar

I just added drawerlayout in my app an changed the background color of toolbar,but drawerlayout button and menu icon are black , it should be white.

style.xml:

 <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>
        <item name="actionMenuTextColor">@color/font</item>
        <item name="android:actionMenuTextColor">@color/font</item>

    </style>

    <style name="AppTheme.NoActionBar">
        <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" />

</resources>

AppBarLayout:

<android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="35dp"
            android:background="?attr/colorPrimary"

            app:layout_scrollFlags="scroll" >

            <com.miguelcatalan.materialsearchview.MaterialSearchView
                android:id="@+id/search_view"
                android:layout_width="30.0dip"
                android:layout_height="match_parent"
                />
        </android.support.v7.widget.Toolbar>

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            app:tabIndicatorColor="@color/tab_normal"
            app:tabSelectedTextColor="@color/tab_se"
            app:tabTextColor="@color/tab_normal"
            />
    </android.support.design.widget.AppBarLayout>

And that is what app looks like:

enter image description here

2 个答案:

答案 0 :(得分:1)

 <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="color">@android:color/black</item>
    </style>

    <style name="MyMaterialTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
        <item name="android:windowAllowEnterTransitionOverlap" tools:targetApi="lollipop">true
        </item>
        <item name="android:windowAllowReturnTransitionOverlap" tools:targetApi="lollipop">true
        </item>
        <item name="android:windowSharedElementEnterTransition" tools:targetApi="lollipop">
            @android:transition/move
        </item>
        <item name="android:windowSharedElementExitTransition" tools:targetApi="lollipop">
            @android:transition/move
        </item>

        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
        <item name="android:statusBarColor">@color/white</item>
        <item name="android:windowLightStatusBar">true</item>

    </style>

答案 1 :(得分:1)

添加新样式以更改汉堡包图标和溢出菜单图标的颜色。

更改汉堡图标颜色

 <style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@android:color/white</item>

更改“溢出菜单颜色” 将此项添加到您当前的样式。

 <item name="android:textColorSecondary">@android:color/white</item>
相关问题