【发布时间】:2014-12-22 12:45:45
【问题描述】:
我正在尝试在我的项目中使用 ActionBarActivity。我已按照https://developer.android.com/tools/support-library/setup.html#中的说明将android-support-v7-appcompat 导入到工作区
我可以将 appcompat 项目作为库添加到我当前的项目 (eclipse) 中。
现在我使用以下导入语句时没有错误。
import android.support.v7.app.ActionBarActivity;
当我从 ActionBarActivity 扩展我的类时没有错误。
public class MyClass extends ActionBarActivity implements ActionBarListener {....}
但是,我在使用 AppCompat 样式时遇到了错误。
在清单中,
<activity
android:name=".Activity1"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
>
....
</activity>
在styles.xml中,
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 11 theme customizations can go here. -->
</style>
我在使用 parent="Theme.AppCompat.Light" 时在 styles.xml 中收到以下错误 ** 错误:检索项目的父项时出错:未找到与给定名称“Theme.AppCompat.Light”匹配的资源。**
为什么我无法访问 appcompat 支持库中的资源。
P.s:我没用过android:showAsAction="never"
我的应用程序项目和 appcompat 都在同一个文件夹中(我将两者都复制到了当前工作区)。
【问题讨论】:
-
尝试清理你的项目
-
试过了。没用。
标签: android eclipse android-support-library android-theme android-actionbaractivity