1

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
            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>

残念ながら、これらのカスタマイズはすべて無視されているようです。この問題を解決するにはどうすればよいですか?

4

1 に答える 1