Issue
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.
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
Solution
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)
Answered By - Cheok Yan Cheng
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.