Mic*_*cky 23 android colors touch android-actionbar
我试图在触摸ActionBar项时更改翻转效果的颜色.在我的Galaxy Nexus 4.0.2上,它是一种绿松石色的阴影,我希望它有不同的颜色.
要清楚,我在这里谈的是ActionBar项目,而不是导航标签.
我在兼容性库下工作了,但对于Android 3.0及更高版本,即"真正的"ActionBar,我只是想不通怎么做.
有谁知道是否以及如何实现这一目标?
Jak*_*ton 46
本机操作栏使用主题属性selectableItemBackground进行操作项背景绘制.这应该是一个状态列表drawable.
这是以下声明Theme.Holo:
<style name="Theme.Holo">
<!-- bunch of things -->
<item name="android:selectableItemBackground">@android:drawable/item_background_holo_dark</item>
<!-- bunch of things -->
</style>
Run Code Online (Sandbox Code Playgroud)
它的可绘制XML:
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<!-- 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/list_selector_disabled_holo_dark" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_dark" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_dark" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_dark" />
<item android:state_focused="true" android:drawable="@drawable/list_focused_holo" />
<item android:drawable="@color/transparent" />
</selector>
Run Code Online (Sandbox Code Playgroud)