2014-07-16 39 views
0

當我點擊我的操作欄中的項目時,我的popum菜單具有黑色背景主題顏色。我想改變我的彈出菜單的主題,使其具有全光(白)色。Android:更改彈出菜單的主題背景

我該怎麼做?

這裏是我的style.xml文件,裏面是空的時刻:

<resources> 

    <!-- 
     Base application theme, dependent on API level. This theme is replaced 
     by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 



    --> 
    <style name="AppBaseTheme" parent="android:Theme.Light"> 
     <!-- 
      Theme customizations available in newer API levels can go in 
      res/values-vXX/styles.xml, while customizations related to 
      backward-compatibility can go here. 



     --> 
    </style> 

    <!-- Application theme. --> 
    <style name="AppTheme" parent="AppBaseTheme"> 

     <!-- All customizations that are NOT specific to a particular API-level can go here. --> 

    </style> 

</resources> 

,並提取艙單:

<application 
     android:name="com.app.ccccccc.activities.cccccccc" 
     android:hardwareAccelerated="true" 
     android:allowBackup="true" 
     android:icon="@drawable/ic_action_blob" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 

回答

2

上,您可以編程寫操作菜單的onclick用於設置背景顏色的代碼。

或使用,

<style name="AppTheme" parent="android:Theme.Light"> 
    <item name="android:popupMenuStyle">@style/PopupMenu</item> 
</style> 

<style name="PopupMenu" parent="@android:style/Widget.PopupMenu"> 
    <item name="android:popupBackground">@android:color/white</item> 
</style> 

manifest.xml: 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
............. 
</application> 
+0

謝謝。你能告訴我,我必須在我的style.xml文件中添加