1

By referring to Styling ActionMode ActionBar in Android 5.0 Lollipop (with AppCompat) and How to set a custom color for the popup of action items, including of the overflow menu?, I tend to change the overflow menu to light theme (Black text, white background)

I use

<style name="Widget.ActionMode" parent="@style/Widget.AppCompat.ActionMode">
    <!-- RED COLOR -->
    <item name="background">@drawable/dummy</item>

    <!-- Hope to get light theme overflow menu. But doesn't work. -->
    <item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
    <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
    <item name="android:actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
    <item name="android:popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>

But, I'm still getting a dark theme menu.

enter image description here

Any idea what went wrong? Note, changing the background of ActionMode ActionBar to red works well.


Extra info

My app theme is Theme.AppCompat.Light.NoActionBar, with <item name="windowActionModeOverlay">true</item>, so that when I startSupportActionMode, the ActionMode ActionBar will cover the Toolbar.

The following is the style used by my app.

<!-- Base application theme. -->
<style name="Theme.Noteplus.Base.Brown" parent="Theme.AppCompat.Light.NoActionBar">

    <!-- Custom action mode style -->
    <item name="actionModeStyle">@style/Widget.ActionMode</item>

    <!-- For action mode -->
    <item name="windowActionModeOverlay">true</item>

For displaying ActionMode ActionBar, I'm using this technique - Display ActionMode over Toolbar

Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875

3 Answers3

0
<style name="PopupMenu"  parent="ThemeOverlay.AppCompat.Dark">

This makes the text black:

<item name="actionMenuTextColor">#000</item>

This changes the background color

<item name="android:popupBackground">#fff</item>

Please let me know if anything changed!

0

I changed from

<!-- Base application theme. -->
<style name="Theme.Noteplus.Base.Brown" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="actionModeStyle">@style/Widget.ActionMode</item>

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

to

<!-- Base application theme. -->
<style name="Theme.Noteplus.Base.Brown" parent="Theme.AppCompat.Light.DarkActionBar">

    <item name="actionModeStyle">@style/Widget.ActionMode</item>

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

solve the problem. (Not exactly sure the reason behind)

Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
  • I know why. If you dive into the parent themes, actually `Theme.AppCompat.Light.DarkActionBar` extending `Base.Theme.AppCompat.Light.DarkActionBar`, when `Base.Theme.AppCompat.Light.DarkActionBar` has a property `@style/ThemeOverlay.AppCompat.Light`, so maybe you don't need to change the parent theme. What you want to do is just move your `@style/ThemeOverlay.AppCompat.Light` from `Widget.ActionMode` to `Theme.Noteplus.Base.Brown`. – HendraWD May 31 '18 at 13:14
0
 <item name="actionOverflowMenuStyle">@style/PopupMenu.Example</item>

 <style name="PopupMenu.Example" parent="@style/Widget.AppCompat.Light.PopupMenu">
    <item name="android:popupBackground">@color/popup_menu</item>
</style>

keyword "overflow". You just need different menu (actionOverflowMenuStyle).

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 14 '22 at 10:42