I want to change the background color of the overflow popup menu to match the background of the main screen. Does anyone know how I could do that?
Thanks.
If you are using a Toolbar, first you need to add this line to your toolbar layout:
app:popupTheme="@style/ThemeOverlay.MyTheme"
It should look like this:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="@color/primary"
app:titleTextColor="@color/white"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.MyTheme"/>
You need to use that line to tell your Toolbar which theme to use. Then, you add the following theme to your styles.xml file:
<style name="ThemeOverlay.MyTheme" parent="ThemeOverlay.AppCompat.Light">
<item name="android:colorBackground">@color/primary</item>
<item name="android:textColor">@color/white</item>
</style>
In the place I put "@color/primary" and "@color/white", you can use any color you want, and you can also put hex values like #000000.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With