• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Problem with Android tutorials

Penyo

Lurker
Hello. I read android tutorials and have a problem with "Styling the Action Bar". My test application has minSdkVersion="8" and targetSdkVersion="17". When I tried to create themes.xml - file with next code I receive errors:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>

<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/actionbar_background</item>

<!-- Support library compatibility -->
<item name="background">@drawable/actionbar_background</item>
</style>
</resources>
Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.Light.DarkActionBar'
Error: No resource found that matches the given name: attr 'actionBarStyle'.
Error: No resource found that matches the given name: attr 'background'.
Error retrieving parent for item: No resource found that matches the given name '@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse'.
I added android-support-v7-appcompat.jar and added it to build path, but again receive these errors. Can you help me?
 
2 things.
1) Do you have your appcompat project marked as library project? If not then right click on appcompat in eclipse, select android and check isLibrary.
2) Right click on your project, add the appcompat as a library project to it and do a clean build.
Thats All.. All the necessary styles are contained in the appcompat project(appcompat/res/values/styles)..:)
 
Back
Top Bottom