ActionBar with AppCompat actionBarItemBackground not working

Viewed 4447

I am trying to change the color of an item when it pressed. I used the actionBarItemBackground item in the action bar style, but nothing happens.. The color not changed...

Here my code:

<style name="ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar.Solid">
    <item name="android:background">@color/actionbar_background</item>
    <item name="titleTextStyle">@style/ActionBarStyle.Title</item>
    <item name="actionBarItemBackground">@drawable/action_bar_item_selector</item>
    <item name="android:actionBarItemBackground" tools:ignore="NewApi">@drawable/action_bar_item_selector</item>
</style>

And the selector:

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/pressed_item" android:state_focused="true"/>
    <item android:drawable="@drawable/pressed_item" android:state_pressed="true"/>
    <item android:drawable="@android:color/transparent"/>

</selector>

And the drawable:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <solid android:color="#FF0000"/>
</shape>

What is worng? Someone?

1 Answers
Related