After adding the library in project by all tutorial I have an error in style.xml
Error: No resources found that matches the given name: attr 'switchStyle'
Error: No resources found that matches the given name: attr 'textAppearance'
In Eclipse i can choose "clean project" and this problem disappear until next change in style.xml
<style name="AppTheme" parent="Theme.Sherlock.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="switchStyle">@style/switch_light</item>
<item name="textAppearance">@style/TextAppearance</item>
<item name="android:actionBarStyle" tools:ignore="NewApi">@style/Widget.Styled.ActionBar</item>
</style>
My steps:
PS. Project is old, created in Eclipse without Gradle.
1) Try to replace module dependency with AAR. Just add this to your build.gradle
:
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}
2) Check your theming. You need to create a custom style for ActionBar, and then apply it. Here is a sample of proper way to do it:
<style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarStyle">@style/Widget.Custom.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.Custom.ActionBar</item>
</style>
<style name="Widget.Custom.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="background">@drawable/bg_striped</item>
<item name="android:background">@drawable/bg_striped</item>
<item name="backgroundSplit">@drawable/bg_striped_split</item>
<item name="android:backgroundSplit">@drawable/bg_striped_split</item>
</style>
In my case problem was in dependencies of third part module from ActionBarSherlock. All trace was: - My project have dependency from ActionBarSherlock and other module which also have dependency from ABS - Project refers to style of ActionBar in this third part module 样式
The whole thing turned out to be in my inattention
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.