【发布时间】:2014-12-18 14:16:34
【问题描述】:
当我创建一个 Android 应用程序项目时,我在 (android:theme="@style/AppTheme") 上的 AndroidManifest.xml 中出现错误 找不到与给定名称匹配的资源(在“主题”处,值为“@style/AppTheme”)。 在 (/res/values/) 目录下,只有 strings.xml。
【问题讨论】:
标签: android
当我创建一个 Android 应用程序项目时,我在 (android:theme="@style/AppTheme") 上的 AndroidManifest.xml 中出现错误 找不到与给定名称匹配的资源(在“主题”处,值为“@style/AppTheme”)。 在 (/res/values/) 目录下,只有 strings.xml。
【问题讨论】:
标签: android
我不确定您是如何开始一个新的 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>
【讨论】: