要更改 PopupMenu 颜色,我尝试定义一个自定义主题,以这种方式在我的应用程序中编辑样式文件
我的 V11 和 v14 的 styles.xml 是这个
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.NoTitleBar">
<!-- API 14 theme customizations can go here. -->
<item name="android:popupMenuStyle">@style/MyPopupMenu</item>
<item name="android:dropDownListViewStyle">@style/MyDropDownListView</item>
<item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
</style>
<!-- style the list navigation -->
<style name="MyDropDownNav" parent="android:style/Widget.Holo.Light.Spinner">
<item name="android:background">#ffffff</item>
<item name="android:popupBackground">#8044ff</item>
<item name="android:dropDownSelector">#ff7700</item>
</style>
<!-- style the overflow menu -->
<style name="MyPopupMenu" parent="android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#8044ff</item>
</style>
<!-- style the items within the overflow menu -->
<style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#8044ff</item>
</style>
</resources>
清单中的 Activity
<activity
android:name=".Home"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppBaseTheme" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
不幸的是,所有这些定制似乎都被忽略了。我该如何解决这个问题?