0

テーマのいくつかの属性の値を変更したいと考えています。

ファイル /platforms/android-15/data/res/themes.xml を調べたところ、テーマの定義にこれらの属性が見つかりました -

    <item name="android:panelMenuIsCompact">false</item>
    <item name="android:panelMenuListWidth">296dip</item>

はい、私のマニフェストには --

 <uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="15" />

私が追加したstyles.xmlファイルに-

<style name="AppTheme" parent="@android:style/Theme">
    <item name="android:panelMenuIsCompact">false</item>
    <item name="android:panelMenuListWidth">296dip</item>
</style>

ビルドすると、行にエラーが発生します-

 No resource found that matches the given name: attr 'android:panelMenuIsCompact'.
 No resource found that matches the given name: attr 'android:panelMenuListWidth'.

これらはテーマ定義にあり、themes.xml と同じディレクトリにあるファイル attrs.xml にもあるため、これらは有効な属性であることがわかります。それで、問題は何ですか?

4

2 に答える 2

0

ご覧のとおり、これらの属性は Themes.xml で定義されています。したがって、あなたの親は次のようになります。

<style name="AppTheme" parent="android:Theme">
    <item name="android:panelMenuIsCompact">false</item>
    <item name="android:panelMenuListWidth">296dip</item>
</style>
于 2013-08-21T00:52:31.047 に答える