I have menu items in my app, and I would like to change color of item background, when it is clicked (please see screenshot - item 1 is clicked)
I just want one color here - either light blue, or dark one. However, as you can see, there are two of them on the first item.
Here is my code:
Toolbar in activity:
<android.support.v7.widget.Toolbar
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_toolbar"
sothree:theme="@style/MyActionBar"
android:layout_alignParentTop="true"
style="@style/toolbarButton">
...
</android.support.v7.widget.Toolbar>
Styles:
<style name="toolbarButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:clickable">true</item>
</style>
<style name="MyActionBar"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/material_dark_blue</item>
<item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
<item name="android:icon">@android:color/transparent</item>
<item name="android:centerX">@android:integer/config_shortAnimTime</item>
<item name="windowActionBar">false</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:textColor">@color/material_white</item>
<item name="android:popupMenuStyle">@style/CustomOverflowBack</item>
<item name="android:itemTextAppearance">@android:color/white</item>
</style>
Manifest:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme">
Any help is highly appreciated.
UPDATE:
Adding CustomOverflowBack
:
<style name="CustomOverflowBack" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">@drawable/menu_item</item>
</style>
Menu_item.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listview_background_shape">
<stroke android:width="1dp" android:color="@color/material_dark_blue" />
<solid android:color="@color/actionbar_item_bg_color" />
</shape>