使用ActionBarSherlock库,使用sherlock作为库后出错

Lee*_*fin 2 android actionbarsherlock

我自己的项目是使用Android 2.1 API 7.

要实现操作栏,我使用ActionBarSherlock库.我将sherlock库作为现有项目导入Eclipse.对于sherlock,目标平台是Android v3.2 API 13.

然后,我将sherlock作为库项目添加到我自己的项目中.然后,我注意到我自己的项目中没有R.java文件gen/夹下的文件,我在eclipse控制台中收到了如下错误:

JakeWharton-ActionBarSherlock-436230d/library/res/values-v11/abs__styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.

JakeWharton-ActionBarSherlock-436230d/library/res/values-v11/abs__styles.xml:48: error: Error: No resource found that matches the given name: attr 'android:actionBarSize'.

JakeWharton-ActionBarSherlock-436230d/library/res/values-v11/abs__styles.xml:49: error: Error: No resource found that matches the given name: attr 'android:actionBarStyle'.

...
Run Code Online (Sandbox Code Playgroud)

我认为这可能是因为sherlock应该使用更高版本的API,所以我尝试在sherlock项目上将目标平台设置为4.03 API 15.但它没有帮助.

任何使用sherlock的人都经历过同样的错误?我怎么解决这个问题?

PS我自己的项目清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="my.frag.test"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".MyActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>
Run Code Online (Sandbox Code Playgroud)

Jak*_*ton 6

您的应用程序和库都需要使用Android 3.2进行编译才能获得适当的支持.

您可以将minSdkVersion清单设置为低至'4',但仍然支持通过Android 1.6.该targetSdkVersion必须设置为"11"或以上.

查看samples/项目文件夹中的示例,了解如何完成此操作.

  • 该网站将在接下来的两周内重做版本4,并且会有更多**更好更全面的文档,包括这样的关键事实. (2认同)