Native ActionBar selectableItemBackground with ActionBarSherlock

拜拜、爱过 提交于 2019-12-10 18:07:41

问题


I try to change the background of an selected item in the ActionBar. I use ActionBarSherlock to be compatible with older Android Versions. I set a specific theme to my Activity when the App runs on a device with ICS.

This is my current style:

<style name="Theme.Custom.Light" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarItemBackground">@drawable/abs__item_background_holo_dark</item>
    <item name="android:selectableItemBackground">@drawable/abs__item_background_holo_dark</item>
</style>

My drawable looks like this:

<selector xmlns:android="http://schemas.android.com/apk/res/android"
      android:exitFadeDuration="@android:integer/config_mediumAnimTime">
    <item android:state_focused="true"  android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_disabled_holo_dark" />
    <item android:state_focused="true"  android:state_enabled="false"                              android:drawable="@drawable/abs__list_selector_disabled_holo_dark" />
    <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/abs__list_selector_background_transition_holo_dark" />
    <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/abs__list_selector_background_transition_holo_dark" />
    <item android:state_focused="true"                                                             android:drawable="@drawable/abs__list_focused_holo" />
    <item                                                                                          android:drawable="@android:color/transparent" />
</selector>

It seems to be that the attribute would not be overrided. What do I wrong?


回答1:


I found the solution by myselft. I simply forgot to copy the png's to my drawable-mdpi and drawable-xhdpi folder.



来源:https://stackoverflow.com/questions/9418018/native-actionbar-selectableitembackground-with-actionbarsherlock

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