3 回答

TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超10個(gè)贊
查看Toolbar和TintManager來(lái)源,drawable/abc_ic_ab_back_mtrl_am_alpha以style屬性的值進(jìn)行著色colorControlNormal。
我確實(shí)嘗試在我的項(xiàng)目中設(shè)置此<item name="colorControlNormal">@color/my_awesome_color</item>主題(帶有主題),但對(duì)我來(lái)說(shuō)仍然是黑色的。
更新:
找到了。您需要使用設(shè)置actionBarTheme屬性(不是 actionBarStyle)colorControlNormal。
例如:
<style name="MyTheme" parent="Theme.AppCompat.Light">
<item name="actionBarTheme">@style/MyApp.ActionBarTheme</item>
<item name="actionBarStyle">@style/MyApp.ActionBar</item>
<!-- color for widget theming, eg EditText. Doesn't effect ActionBar. -->
<item name="colorControlNormal">@color/my_awesome_color</item>
<!-- The animated arrow style -->
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>
<style name="MyApp.ActionBarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<!-- THIS is where you can color the arrow! -->
<item name="colorControlNormal">@color/my_awesome_color</item>
</style>
<style name="MyApp.ActionBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar">
<item name="elevation">0dp</item>
<!-- style for actionBar title -->
<item name="titleTextStyle">@style/ActionBarTitleText</item>
<!-- style for actionBar subtitle -->
<item name="subtitleTextStyle">@style/ActionBarSubtitleText</item>
<!--
the actionBarTheme doesn't use the colorControlNormal attribute
<item name="colorControlNormal">@color/my_awesome_color</item>
-->
</style>

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超6個(gè)贊
嘗試了以上所有建議。我設(shè)法在工具欄中更改導(dǎo)航圖標(biāo)默認(rèn)后退按鈕箭頭顏色的唯一方法是在基本主題中設(shè)置colorControlNormal,如下所示。可能是因?yàn)楦讣?jí)正在使用Theme.AppCompat.Light.NoActionBar
<style name="BaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorControlNormal">@color/white</item>
//the rest of your codes...
</style>
添加回答
舉報(bào)