Search code examples
androidandroid-actionbarandroid-actionmode

How to change the style of divider lines on contextual ActionMode bar


I am trying to style an ActionMode bar with a transparent background. The transparent background works fine - but the lines around the share button(s) - to show that the two buttons are linked become almost invisible.

I've tried various styling solutions based on an extensive web search so far but nothing seems to work.

With transparent background styling:

<style name="My.Widget.ActionMode" parent="@android:style/Widget.DeviceDefault.ActionMode">
<item name="android:background">@android:color/transparent</item>
<item name="android:actionModeBackground">@android:color/transparent</item>
<item name="android:backgroundSplit">?android:attr/actionModeSplitBackground</item>
<item name="android:actionModeSplitBackground">?android:attr/actionModeSplitBackground</item>
</style>

enter image description here

Without transparent styling:

<style name="My.Widget.ActionMode" parent="@android:style/Widget.DeviceDefault.ActionMode">
<item name="android:backgroundSplit">?android:attr/actionModeSplitBackground</item>
<item name="android:actionModeSplitBackground">?android:attr/actionModeSplitBackground</item>
</style>

enter image description here

I've tried adding various things, a few examples follow, however nothing seems to have any effect.

<item name="android:actionBarDivider">@android:color/holo_green_light</item>
<item name="android:divider">@android:color/holo_green_light</item>

<item name="android:backgroundSplit">?android:attr/actionModeSplitBackground</item>
<item name="android:actionModeSplitBackground">?android:attr/actionModeSplitBackground</item>

Does anybody know what the correct way to do this is?


Solution

  • I solved this in the end by switching to "AppCompat" themes.

    With AppCompat enabled I could then control the share activity divider and borders by overriding "activityChooserViewStyle".