【发布时间】:2014-05-15 17:54:44
【问题描述】:
我知道这个标题有很多问题,但我的问题还没有解决。
我使用 ActionBar Compact 来实现 actionbar。
现在,我想更改它的选择器(项目突出显示)颜色。
我用这个代码做选择器:
<item android:state_window_focused="false" android:drawable="@color/MyColor_Transparent" />
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/myforebackground_green" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/myforebackground_green" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/mybackground_b" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/mybackground_b" />
<item android:state_focused="true" android:drawable="@drawable/mybackground_b" />
<item android:drawable="@color/MyColor_Transparent" />
也用过:
<item name="android:selectableItemBackground">@drawable/my_selector</item>
在styles.xml中
但是没有用。
我也用过这个链接:
how can i change the touch affect color of actions with actionbarsherlock
actionbarcompat support library android selectable item background not working
但还是不行。
【问题讨论】:
标签: android android-actionbar android-theme android-actionbar-compat