Skip to content

Instantly share code, notes, and snippets.

@thinzaroo
Created August 18, 2014 14:46
Show Gist options
  • Save thinzaroo/f032aeed6cc1b6efee57 to your computer and use it in GitHub Desktop.
Save thinzaroo/f032aeed6cc1b6efee57 to your computer and use it in GitHub Desktop.
Setting Action Bar background color (appcompat) support all versions
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.actionbartest2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomActionBarTheme"
>
<activity android:name="ActionBarTestMainActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background" tools:ignore="NewApi">@color/accent_green</item>
<item name="background">@color/accent_green</item>
</style>
<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light">
<item name="android:actionBarStyle" tools:ignore="NewApi">@style/MyActionBar</item>
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment