首先让我说我是 Android 编程的新手。我正在使用 Pragmatic 的 Hello Android 书籍(第 3 版)。我正在处理流行的数独游戏示例,在从书中复制要放入 main.xml 文件中的代码后,出现以下错误:
error: Error: No resource found that matches the given name (at 'background' with value '@color/background')
.
error: Error: No resource found that matches the given name (at 'text' with value '@string/main_title').
error: Error: No resource found that matches the given name (at 'text' with value '@string/continue_label').
error: Error: No resource found that matches the given name (at 'text' with value '@string/new_game_label').
error: Error: No resource found that matches the given name (at 'text' with value '@string/about_label').
error: Error: No resource found that matches the given name (at 'text' with value '@string/exit_label').
他们可能都是相关的,但经过一番搜索,我不知道是什么问题。有什么建议吗?
最佳答案
错误说明了一切。你有一个 res 文件夹,你的资源如字符串/图像/布局可以驻留。所以你正在引用资源但它们不存在。就像你正在引用 about_label 字符串但在你的字符串 xml 中没有字符串 about_label 的标记及其值。请参阅 res->strings。检查所有 xml 文件并将您尝试使用的资源放入程序中
关于java - 找不到与给定名称匹配的资源(在 'text' 处,值为 '@string/continue_label' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6793193/