我正在使用新的android appcompat工具欄。我需要爲漢堡圖標和後退箭頭圖標設置相同的自定義顏色。使用drawerArrowStyle允許我改變漢堡圖標,但不是箭頭。這個問題只在棒棒糖設備上,任何棒棒糖都可以。Android:無法更改後退箭頭導航圖標的顏色
下面是代碼:
工具欄:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/my_primary"
local:theme="@style/My.Toolbar"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
Style.xml:
<style name="Theme.Base" parent="Theme.AppCompat.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/my_primary</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/black</item>
</style>
<style name="My.Theme" parent="Theme.Base">
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>
<style name="My.Toolbar" parent="Theme.AppCompat.NoActionBar">
<!-- color of the title text in the Toolbar, in the Theme.AppCompat theme: -->
<item name="android:textColorPrimary">@color/my_actionbartext</item>
<!-- necessary to support older Android versions.-->
<item name="actionMenuTextColor">@color/my_actionbartext</item>
<item name="android:textColorSecondary">@color/my_actionbartext</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">@color/my_actionbartext</item>
</style>
我試過使用here的解決方案,但沒有奏效。任何人有任何想法?
可能重複[如何改變新材料題材後退箭頭的顏色?(http://stackoverflow.com/questions/26788464/how-to-change-color-of-the- back-arrow-in-the-new-material-theme) – Daniel 2015-05-19 15:58:19