我正在尝试在我的应用程序中包含 ActionBar V7。在 AndroidManifest.xml 我把
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
在值/style.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
在价值观-v11
<?xml version="1.0"?>
-<resources>
<!-- Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. -->
-<style parent="Theme.AppCompat.Light" name="AppBaseTheme">
<!-- API 11 theme customizations can go here. -->
</style></resources>
在价值观-v14
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
在我放的活动中
import android.support.v7.app.ActionBarActivity;
public class MainActivity extends ActionBarActivity
执行后告诉我项目中存在错误。确切地说,错误在所有 style.xml 中,错误是“错误:检索项目的父项时出错:找不到与给定名称'Theme.AppCompat.Light'匹配的资源。”为什么我有这个错误以及我如何修复它?我将库 android-support-v7-appcompat.jar 放在 /libs 中,然后右键单击将其添加到 Build Patch。我也尝试重新启动 Eclipse,但它的工作方式不一样。