我认为这是一个简单的问题,但我一直没有找到我的特定问题的答案。
我已经阅读了这篇优秀的文章,并希望设置Android Dropdown列表中股票ActionBar上选定项目的背景颜色(如下面的图像链接所示)。
我已经阅读了这篇优秀的文章,并希望设置Android Dropdown列表中股票ActionBar上选定项目的背景颜色(如下面的图像链接所示)。
到目前为止,我已经以这种方式设置了我的主题:
<resources>
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<item name="android:dropDownListViewStyle">@style/MyDropDownListView</item>
</style>
<style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">@drawable/ad_selectable_background</item>
</style>
</resources>
这是我的ad_selectable_background.xml文件:
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime" >
<item android:state_pressed="true" android:drawable="@android:color/holo_blue_light" />
<item android:drawable="@android:color/transparent" />
</selector>
我的下拉视图资源是:
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
按下状态可以使用,但打开菜单时没有选择项显示。
我想使用选择器将其设置为holo_blue_light,但我无法找到正确的语法使用XML。
如果可能的话,我希望只用XML来回答(即不使用任何代码)。谢谢!