2
votes

I'm trying to set the highlight color of action items in my action bar, however I'm not sure how to do it for lower API levels.

The app I'm working on has a minimum SDK level of 8, however the attribute for setting highlight color of action items in an action bar requires higher SDK level.

I tried to add this item to my app's base theme style:

<item name="android:actionBarItemBackground">@android:color/transparent</item>

however it requires API level of 14.

How can I do it with API level of 8, using the support action bar?

1
If you don't want to manually do it yourself, just use something like the Android ActionBar Style Generator.ChuongPham

1 Answers

0
votes

Not completely sure if this will work as intended. You create an xml file in your layout folder which defines the different states of a button

 <?xml version="1.0" encoding="UTF-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android"> 
      <item android:state_pressed="true" android:drawable="@color/darkOrange"/> 
      <item android:drawable="@color/lightOrange"/>
 </selector>