Monday, August 13, 2012

Theming the ActionBarSherlock in Android


If you want to customize your ActionBarSherlock follow this steps:

1. Create in values folder a new file style.xml

2. In style.xml file determine your styles you want for ActionBarSherlock e.g. :
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
    <item name="background">@drawable/bgraund</item>
    <!-- <item name="android:background">@drawable/top_bar</item> -->
    <item name="backgroundSplit">@drawable/bgraund</item>
    <item name="android:background">@drawable/bgraund</item>
</style>
</resources>


3. In your AndroidManifest.xml determine this your custom style that you just created in style.xml:
<application android:icon="@drawable/adsurfer_icon" 
        android:label="@string/app_name"
        android:debuggable="true"
        android:name=".app.AdsurferApplication"
        android:theme="@style/Theme.Styled" >


I've found helpful info on this topic in this article:

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties

In order to fix this error:

1. Go to the Properties for your project (double click on your project), then find out Adroid Tools/Project Properties (see screenshot)


2. Then change Compile Compiance level to the higher level e.g 1.5 or 1.6 (That is it :) )