简体   繁体   中英

Error on Adding ActionBarSherlock in Intellij-Idea 13

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:

  • Project created in Eclipse and now imported to IntelliJ IDEA
  • Project and ActionBar SDK settings - Google Android 4.4.2
  • Manifest project settings: minSDK - 10; target SDK - 19
  • Add module to project setting (not jar - all ActionBar project by import module -> chose ActionBar folder -> create module from existing source or import from external module Eclipse)
  • Add in module dependency to support-v4
  • Add ActionBar module to dependency for Project module
  • In Facets ActionBar module is library
  • Remove from imported ActionBar module test folder
  • Rebuild project - error
  • Make project - error.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM