Android ActionBar change Item color on click

久未见 提交于 2020-01-07 06:43:26

问题


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:


<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>


来源:https://stackoverflow.com/questions/14197066/android-actionbar-change-item-color-on-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!