NOTE: I have searched for an hour and tried all solutions already provided by stackoverflow.
I am studying theme over
Try it out
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
<item name="android:colorBackground">@color/white</item>
<item name="android:textColor">@color/grey_900</item>
</style>
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>
i hope it will work.
This worked for me
<item name="android:itemBackground">@color/primary</item>
Insert that into your main style I hope this works for you
<style name="YOURSTYLE" parent="Widget.AppCompat.PopupMenu">
<item name="android:textColor">@android:color/white</item>
<item name="android:itemBackground">@android:color/holo_red_light</item>
</style>
Context wrapper = new ContextThemeWrapper(this, R.style.YOURSTYLE);
PopupMenu popup = new PopupMenu(wrapper, view);
May be its helps you
None of the above solutions worked for me, so this is how I fixed it:
First of all make a new Theme for the Activity, and:
<style name="Theme.YourTheme" parent="Theme.AppCompat">
<item name="android:itemBackground">@color/white</item>
<item name="android:textColor">@color/black</item>
</style>
To make the background of items white
<item name="android:itemBackground">@color/white</item>
To counter make the text color black
<item name="android:textColor">@color/black</item>
Lastly, apply the theme to your Activity via Manifest:
<activity android:name=".YourActivity"
android:theme="@style/Theme.YourTheme"/>
Use popupTheme from AppCompat toolbar
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:popupTheme="@style/MyTheme"/>
In Style :
<style name="MyTheme" parent="ThemeOverlay.AppCompat.Light">
<item name="android:colorBackground">@color/colorPrimary</item>
<item name="android:textColor">@color/white</item>
</style>
Hope it will work.