1
我不得不關注以下問題,我想從操作欄項目(只是普通的操作欄,既不支持操作欄也不是actionbarsherlock)更改選擇器。如果按下項目圖標,背景顏色應該是灰色的,而不是默認的藍色。我搜索了很多,知道我需要在樣式中重寫屬性android:actionBarItemBackground,但我的選擇器仍然無效,背景色是透明的,但按下狀態的顏色不是灰色,它保持透明。 :/選擇器爲actionBarItemBackground不工作
這裏是我的代碼:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarItemBackground">@drawable/action_bar_item_drawable</item>
</style>
,並在這裏繪製
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<item android:drawable="@android:color/transparent"/>
<item android:drawable="@color/grey" android:state_pressed="true"/>
</selector>
任何人的想法?