Android ActionBar change Item color on click

2019-08-27 04:03发布

In the action bar I have items that are presented in text, not icons. On click I want to change the color of this text from blue to white. I don't want to change the background with the

<item name="selectableItemBackground"></item>

only the text color. Anyone has any ideas?

1条回答
\"骚年 ilove
2楼-- · 2019-08-27 04:39
<style name="AppTheme" parent="android:Theme.Holo">
    <item name="android:actionMenuTextColor">@color/action_item_text_color</item>
</style>

R.color.action_item_text_color:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:color="#fff"/>
    <item android:color="#00f"/>
</selector>
查看更多
登录 后发表回答