I cannot figure out how to change the action bar items "onPressed" color on Android. I'm not talking about the action bar background color but about the blue over state. How can I change the color of this or at least get rid of it? For instance the App Icon with the homeAsUpIndicator.
I tried to change the action bar style and also the menu item style but nothing worked.
Thanks
EDIT Here is my implementation so far:
My style xml:
<style name="Theme.AppTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:selectableItemBackground">@android:color/transparent</item>
<item name="android:windowEnterAnimation">@anim/fadein</item>
<item name="android:windowExitAnimation">@anim/fadeout</item>
<item name="android:actionBarItemBackground">@android:color/transparent</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/actionbarheader</item>
<item name="android:backgroundStacked">@drawable/actionbarheader</item>
<item name="android:backgroundSplit">@drawable/actionbarheader</item>
<item name="android:titleTextStyle">@style/ActionBarTitle</item>
<item name="android:actionBarItemBackground">@android:color/transparent</item>
<item name="android:actionButtonStyle">@style/MyActionButtonStyle</item>
<item name="android:homeAsUpIndicator">@drawable/actionbarlogo</item>
<item name="android:icon">@drawable/app_icon</item>>
</style>
<style name="ActionBarTitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textSize">20sp</item>
</style>
<style name="MyActionButtonStyle" parent="@android:style/Widget.Holo.Light.ActionButton">
<item name="android:background">@android:color/transparent</item>
</style>
Then I have a drawable for the actionbarogo:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/actionbarlogo_on" android:state_pressed="true"/>
<item android:drawable="@drawable/actionbarlogo_on" android:state_focused="true"/>
<item android:drawable="@drawable/actionbarlogo_off"/>
</selector>
My menu xml for the action bar items:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/ContactsMode"
android:icon="@drawable/actionbarcontacts"
android:title="@string/contacts"
android:orderInCategory="100"
android:showAsAction="always"
android:background="@android:color/transparent" />
</menu>
and finally, the item's drawable:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/actionbarcontacts_on" android:state_pressed="true"/>
<item android:drawable="@drawable/actionbarcontacts_on" android:state_focused="true"/>
<item android:drawable="@drawable/actionbarcontacts_off"/>
</selector>
Here is how I create the Menu Items for the ActionBar:
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
actionBar.setIcon(R.drawable.actionbarlogo);
return true;
}
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem item= menu.findItem(R.id.ContactsMode);
if(ContactsButton)
item.setVisible(true);
else
item.setVisible(false);
return true;
}