How to change background color popup menu android How to change background color popup menu android android android

How to change background color popup menu android


Add popupMenu style to ur AppTheme:

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


Please Add Following lines in style xml file, I hope this will help for material design application.Style.xml

<!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">    <!-- Customize your theme here. -->    <item name="colorPrimary">@color/colorPrimary</item>    <!-- To change the popup menu and app text color  -->    <item name="android:textColor">@color/colorPrimary</item>    <!-- To change the background of options menu-->    <item name="android:itemBackground">@color/skyBlue</item></style>

For more details refer this link http://www.viralandroid.com/2016/01/how-to-change-background-and-text-color-of-android-actionbar-option-menu.html


If your are using AppCompact-v7 then you can style PopupMenu as below:

 <style name="AppTheme" parent="Theme.AppCompat.Light">    <item name="popupMenuStyle">@style/popupMenuStyle</item></style><style name="popupMenuStyle" parent="Widget.AppCompat.PopupMenu">    <item name="android:popupBackground">@android:color/white</item></style>

NOTE: PopMenu always works with Activity Context, not with Application context.