Reputation: 73
When I click item in popup menu its TextView background remains the same.
Screen: https://i.sstatic.net/vtrGN.png
I use Toolbar:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="@dimen/actionbar_height"
app:popupTheme="@style/PopupMenu"
app:theme="@style/Toolbar" />
With custom theme for Popup menu:
<style name="Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorPrimary">@color/background</item>
<item name="android:height">@dimen/actionbar_height</item>
<item name="android:actionModeBackground">@color/background</item>
</style>
<style name="PopupMenu" parent="ThemeOverlay.AppCompat.Dark">
<item name="android:background">@color/background</item>
</style>
How to make select work properly?
Upvotes: 2
Views: 1457
Reputation: 3156
ColorBackground as mentioned by ZoserLock didn't work for me either I had to have
<item name="android:background">@color/background</item>
<item name="android:drawSelectorOnTop">true</item>
I also found android:backgroundTint did the same thing as background.
<item name="android:backgroundTint">@color/background</item>
<item name="android:drawSelectorOnTop">true</item>
NOTE: if you are using your own selector using selectableItemBackground and your selector isn't transparent drawSelectorOnTop won't work as it will cover your text. I'm yet to find a solution I am happy with.
Upvotes: 1
Reputation: 111
I had the same problem and with try and error i found that using:
<item name="android:colorBackground">@color/background</item>
instead of
<item name="android:background">@color/background</item>
Solves the problem for me, i dont know if achieve the same result but al least does not show the uggly background.
Upvotes: 1