Skip to content Skip to sidebar Skip to footer

How To Change Background Color Of Overflow Menu (popup Menu) For Action Bar

I am using android compact library for building the action bar for both older and newer versions of android. so my requirement includes that i need to show action bar in blue color

Solution 1:

Add this to your toolbar element

app:popupTheme="@style/ThemeOverlay.YourApp"

Then in your styles.xml define the popup menu style

<stylename="ThemeOverlay.YourApp"parent="ThemeOverlay.AppCompat.Light"><itemname="android:colorBackground">@color/your_background_color</item><itemname="android:textColor">@color/your_text_color</item></style>

Note that you need to use colorBackground and never background. The latter would be applied to everything (the menu itself and each menu item), the former applies only to the popup menu.

Source: Style appcompat-v7 Toolbar menu background

Solution 2:

Use android:popupBackground into styles.

like

<stylename ="MyPopupMenu"parent="Theme.AppCompat.Light"><itemname="popupMenuStyle">@style/MyPopupMenuStyle</item></style><stylename="MyPopupMenuStyle"><itemname="android:dropDownSelector">@drawable/abc_list_selector_holo_dark</item><itemname="android:popupBackground">@drawable/abc_menu_dropdown_panel_holo_dark</item><itemname="android:dropDownVerticalOffset">0dip</item><itemname="android:dropDownHorizontalOffset">0dip</item><itemname="android:dropDownWidth">wrap_content</item></style>

Post a Comment for "How To Change Background Color Of Overflow Menu (popup Menu) For Action Bar"