While using the ActionBarSherlock
in xml at:
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
I got this error:
android:actionBarStyle requires API level 11 (current min is 8) error
I'm using it for back porting my app with actionbar to 2.2 devices.
How to use them both together:
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
Another option is to use the tools:targetApi
attribute, which requires the tools
namespace. This acts in a similar fashion to the @TargetApi
annotation you can use in java files.
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="MyThemes.MyTheme">
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle" tools:targetApi="11">@style/Widget.Styled.ActionBar</item>
</style>
</resources>
Note the xmlns:tools="http://schemas.android.com/tools"
in the <resources>
tag, as it is required.