-1

I know there are many questions with this title , but my problem did not solved yet.

I used ActionBar Compact for implementing actionbar.

Now , i want to change its selector (item highlight) color.

I used this code for selector:

<item android:state_window_focused="false" android:drawable="@color/MyColor_Transparent" />

<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true"  android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/myforebackground_green" />
<item android:state_focused="true"  android:state_enabled="false"                              android:drawable="@drawable/myforebackground_green" />
<item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/mybackground_b" />
<item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/mybackground_b" />
<item android:state_focused="true"                                                             android:drawable="@drawable/mybackground_b" />
<item android:drawable="@color/MyColor_Transparent" />

And also used:

<item name="android:selectableItemBackground">@drawable/my_selector</item>

In styles.xml

But it didn't work.

I used this links too:

selectable item background

how can i change the touch affect color of actions with actionbarsherlock

actionbarcompat support library android selectable item background not working

But it still not working.

Community
  • 1
  • 1
Behnam Maboudi
  • 655
  • 5
  • 21

1 Answers1

1

You can use the ActionBar Theme generator at http://jgilfelt.github.io/android-actionbarstylegenerator/ to make exactly what you want. Super simple, turns out great; just extract the files to your project and set the theme in the manifest (or programatically if that's your thing). And I combined it with http://android-holo-colors.com/ to make my whole app follow a common theme, but you will need to move some stuff around in the XML to get the two themes displayed as one.

cjbrooks12
  • 1,368
  • 1
  • 13
  • 25