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

  • Draw circle in android
  • How do I invoke the search dialog using onSearchRequested()
  • animation to transition between views with rotation on z-axis with depth perception
  • connecting android apps to mysql database
  • Throwing OutOfMemoryError “pthread_create (1040KB stack) failed: Try again” when doing asynchronous posts using Volley
  • 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:

    How does one implement drag and drop for Android marker?
    How to stop video playing in VideoView programmatically in android?
    Samsung Multiwindow crash
    TextView Ellipsize (&hellip;) not working
    run service even if the application is closed (killed)
    Playing youtube video in Android app
  • Google Developer Console project creation limit
  • APK won't install: DalvikVM cannot optimize it (Byte swap and verify fails)
  • Is there Android Intent concept in iPhone SDK
  • Android: Speech Recognition without using google server
  • Using ImageView for panoramic view
  • Anko toast() method causes java.lang.NoSuchMethodError when called from Fragment
  • 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.