2013-07-03 32 views
1

要改變PopupMenu的顏色,我試圖定義一個我自定義主題編輯風格在我的應用程序文件,以這種方式Android的風格PopopMenu ingnored

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

不幸的是所有這些定製似乎忽略了活動。我該如何解決這個問題?

回答

0

在活動標籤中使用您想要的主題名稱。

目前使用的是安卓主題= 「@風格/ AppBaseTheme」

而不是採用Android:主題= 「@風格/ your_theme_name」

其中your_theme_name可能是:MyDropDownNav或MyPopupMenu或MyDropDownListView。

+0

尚未嘗試但結果相同 – AndreaF