【问题标题】:Error on @style/Apptheme and Style.xml file doesn't exist@style/Apptheme 和 Style.xml 文件不存在错误
【发布时间】:2014-12-18 14:16:34
【问题描述】:

当我创建一个 Android 应用程序项目时,我在 (android:theme="@style/AppTheme") 上的 AndroidManifest.xml 中出现错误 找不到与给定名称匹配的资源(在“主题”处,值为“@style/AppTheme”)。 在 (/res/values/) 目录下,只有 strings.xml。

【问题讨论】:

    标签: android


    【解决方案1】:

    我不确定您是如何开始一个新的 Android 项目的,但可能出了点问题。在您的应用程序文件夹中,您应该有/res/values/styles.mxl。无需过多介绍,它应该看起来像这样(取自Using the Material Theme,您也需要支持以前的版本):

    <resources>
      <!-- inherit from the material theme -->
      <style name="AppTheme" parent="android:Theme.Material">
        <!-- Main theme colors -->
        <!--   your app branding color for the app bar -->
        <item name="android:colorPrimary">@color/primary</item>
        <!--   darker variant for the status bar and contextual app bars -->
        <item name="android:colorPrimaryDark">@color/primary_dark</item>
        <!--   theme UI controls like checkboxes and text fields -->
        <item name="android:colorAccent">@color/accent</item>
      </style>
    </resources>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-03
      • 2014-03-28
      • 2015-02-10
      • 2016-03-16
      • 1970-01-01
      • 2016-09-22
      相关资源
      最近更新 更多