在点击Android的动作条更改项目颜色 [英] Android ActionBar change Item color on click
本文介绍了在点击Android的动作条更改项目颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在操作栏中我是psented文本$ P $,而不是图标等项目。在点击我想这个文本的颜色变化从蓝色变成白色。我不想改变的背景
<项目名称=selectableItemBackground>< /项目>
只有文字颜色。任何人有任何想法?
解决方案
<样式名称=AppTheme父=机器人:Theme.Holo>
<项目名称=机器人:actionMenuTextColor> @色/ action_item_text_color< /项目>
< /风格>
R.color.action_item_text_color
:
< XML版本=1.0编码=UTF-8&GT?;
<选择的xmlns:机器人=http://schemas.android.com/apk/res/android>
<项目的android:STATE_ pressed =真正的机器人:颜色=#FFF/>
<项目的android:颜色=#00F/>
< /选择器>
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?
解决方案
<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>
这篇关于在点击Android的动作条更改项目颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文