I have a TextView
inside of my action bar, like the following:
I have logic configured to make it overlay the Toolbar
with an ActionMode
when I long-press on an item in the associated ListView
. This ends up looking like the following:
This is basically correct, except for the annoying background around the TextView
title in the ActionMode
.
I've tried quite a few things, from changing the Widget.ActionMode
style in my styles.xml
file, to actually setting the actionModeStyle
to a specific style. Nothing seems to affect this TextView
, though.
I have read through How to change ActionMode background color in Android but it doesn't seem like anything I do has an effect on this background.
Side Note: It would be really nice if there were some way to view the style hierarchy on an Android device as it's rendered. The hierarchy viewer gets me about 1/3 of the way there, but it doesn't have any style information. Anyone know of such a tool that I could use to debug this problem?
styles.xml (only relevant stuff):
<style name="Material" parent="Theme.AppCompat.Light">
<item name="textHeaderMaxLines">@integer/text_header_max_lines</item>
<item name="trackAbstractMaxLines">@integer/track_abstract_max_lines</item>
<item name="activatableItemBackground">@drawable/activatable_item_background</item>
<!-- ActionMode Styles -->
<item name="android:windowActionModeOverlay">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">@color/app_green_dark</item>
</style>
<style name="Material.AppBar" parent="Theme.AppCompat.NoActionBar">
<item name="android:textColorPrimaryInverse">@android:color/white</item>
<item name="android:actionMenuTextColor">@android:color/white</item>
<item name="android:textColorSecondary">@android:color/white</item>
<item name="android:background">@color/app_green</item>
<item name="android:color">@android:color/white</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="Material.AppBar.ActionMode" parent="Widget.AppCompat.Light.ActionMode.Inverse">
<item name="android:background">@color/app_green_dark</item>
</style>
EditText
, it's the defaultTextView
that's a title within theActionMode
. I set the text itself withsetTitle()
on theActionMode
object. I would like to know how to set the style, since the current solutions I gleaned from the other SO posts don't seem to do anything. – Komsa