Styling the popup menu in Android 5.0

I’m making my app ready for Android 5.0, I’m using the latest compatibility library, here is what my style looks like.

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/theme_accent</item>
        <item name="colorAccent">@color/theme_accent_secondary</item>

    <style name="AppThemeDark" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/theme_accent</item>
        <item name="colorAccent">@color/theme_accent_secondary</item>

(The ActionBar color is being set programmatically.)

  • Catch all type exceptions programming Android
  • Android - save value on LocalStorage before WebView.loadUrl()
  • How to make AccountManager (authtoken) and OpenID work together (without AppEngine)?
  • Intent to open Instagram user profile on Android
  • APK size is bigger than expected - android studio
  • How to replicate iOS 7 Blur View in Android
  • Now, I want the overflow/popup menu to have the dark background like it had in the holo implementation, but I can’t get it to work, here is what it looks like: enter image description here

    I have tried setting the popupMenuStyle but it didn’t work.

    How can I make the popup menu darker?

    Related posts:

    ListView inside ScrollView is not scrolling on Android
    how to access the drawable resources by name in android
    CCAVENUE Payment Gateway integration with Android app
    Send data from activity to fragment in android
    CollapsingToolbar not working with not-so-tall content
    How to add Image to spinner in Android
  • Using a custom subclass of SharedPreferences with PreferenceActivity or PreferenceFragment
  • How to create a custom LayoutParams to be used on a custom layout?
  • Android: Fragments: setContentView alternative
  • FileProvider throws exception on GetUriForFile
  • Tap outside edittext to lose focus
  • Programmatically create TextView with ellipsis
  • 4 Solutions collect form web for “Styling the popup menu in Android 5.0”

    Stop using the ActionBar. If you want a ToolBar to be set up like an ActionBar, follow this guide on the android-developers blog.

    It actually mentions your use case at Dark Action Bar and provides this code:

        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    Not a full answer but what I found so far:

    In past versions you needed to specify a drawable (Check code and tutorials)

    Apparently, now that is a color. To modify it you need to do specify the following theme:

    <resources xmlns:android="">
        <style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
            <item name="android:actionBarPopupTheme">@style/popupNew</item>
        <style name="popupNew" parent="android:ThemeOverlay.Material.Light">
            <item name="android:colorBackground">@color/red</item>

    This works correctly if the theme applied to the app is just this.
    If I add android:actionBarPopupTheme to my existing theme, it doesn’t work. I am trying to figure out why.

    Add the property popupTheme to your toolbar:

      app:popupTheme="@style/Theme.AppCompat" />

    Or define a new style for your toolbar:

    <style name="MyToolBarStyle" parent="Widget.AppCompat.Toolbar">
        <item name="android:background">@color/green</item>
        <item name="popupTheme">@style/Theme.AppCompat.Light</item>
        <item name="theme">@style/Theme.AppCompat</item>

    Solved my problem by using this style:

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/theme_accent</item>
        <item name="colorAccent">@color/theme_accent_secondary</item>
        <item name="actionBarStyle">@style/AbStyle</item>
        <item name="actionModeBackground">@color/actionmode_bg</item>
    <style name="AbStyle" parent="Widget.AppCompat.Toolbar">
        <item name="elevation">2dp</item>
        <item name="displayOptions">homeAsUp|showTitle</item>
    <style name="AppThemeDark" parent="Theme.AppCompat">
        <item name="colorAccent">@color/theme_accent_secondary</item>
        <item name="actionBarStyle">@style/AbStyle</item>

    I had to use Widget.AppCompat.Toolbar as the parent actionBarStyle

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.