Reputation: 667
I added Sherlock library to my project and I added required classes and codes to my project. When I test it, action bar appears only in android 4 emulator. When I try it in 2.1 emulator, Actionbar does not appear. Can you give some suggestions how can I fixed it? I set my target 15 for both sherlock library and my project.
Upvotes: 1
Views: 862
Reputation: 25757
You need to have done the following:
Set the min and target SDK levels appropriately
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />
Changed your Activity
's to SherlockActivity
's, and Fragment
's to SherlockFragment
's
Set your theme to either one of your own that has a parent of, or is the direct theme Theme.Sherlock
or one of its child themes e.g. Theme.Sherlock.Light
Finally; the ABS styles mirror those of the native action bar therefore you need to define each style element twice. For example:
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="background">@drawable/blue_gradient</item>
<item name="android:background">@drawable/blue_gradient</item>
<item name="displayOptions">useLogo|showHome</item>
<item name="android:displayOptions">useLogo|showHome</item>
<item name="icon">@drawable/actionbar_logo</item>
<item name="android:icon">@drawable/actionbar_logo</item>
<item name="backgroundSplit">@drawable/bg_striped_split</item>
<item name="android:backgroundSplit">@drawable/bg_striped_split</item>
</style>
Edit: I did a video tutorial towards getting started too: http://www.youtube.com/watch?v=4GJ6yY1lNNY
Upvotes: 1