java - Theme.AppCompat.Light.DarkActionBar - 找不到资源

标签 java android adt

如何正确使用 Android 支持库,因为我的 list 文件中有此错误:

android:theme="@style/Theme.AppCompat.Light.DarkActionBar"

error: Error: No resource found that matches the given name 
(at 'theme' with value '@style/Theme.AppCompat.Light.DarkActionBar').
AndroidManifest.xml /ttab   line 39 Android AAPT Problem

我的 friend 之前在其他计算机上为我完成了此操作,现在我必须独自完成此操作。请帮帮我:)

我正在使用 ADT

我的样式.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="android:Theme.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>

    <style name="Theme.AppCompat.Light">
     <!-- theme customizations here. -->
    </style>


    <style name="Theme.AppCompat.Light.DarkActionBar" parent="Theme.AppCompat.Light">
      <!-- theme customizations here. -->
    </style>


</resources>

最佳答案

在“android-support-v7-appcompat”项目中:

  • 从包资源管理器中删除“android-support-v7-appcompat”。
  • 再次导入并勾选“复制到工作区”
  • 在 Properties -> Android -> Project build target 中,取消选中 Android 2.2 并选中 Android 4.1.2
  • 在 Java 构建路径中,取消选中是否有任何 .jar 库,并取消选中 Dependences

另一方面,使用“android-support-v7-appcompat”的项目:

  • 在 Properties -> Android 添加库,但取消选中“IsLibrary”。
  • 在 Android -> Project build tarjet 检查 Android 4.0。
  • 在“Java 构建路径”中 -> 订购和导出 -> 取消选中 .jar 库
  • 最后做一个“项目->清理”两个项目

关于java - Theme.AppCompat.Light.DarkActionBar - 找不到资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18364682/

相关文章:

java - 使用单选按钮更新 JPanel

java - 无法在 API 23 及更低版本上下载 PDF 文件

android - 试图模拟 Environment.getExternalStorageState

c++ - 基于数组的堆栈 - 析构函数中的错误

java - 在java和groovy中准确表示时间

java - 查找字符串中最长的单词

android - ADT 是否支持 Java 7 API

java - 使用 Android 开发工具更新 Eclipse v. 23

java |找不到符号 |返回一个对象

android - 在ListView中添加多个Image并获取每个点击事件