Ski*_*izz 11 java eclipse android
首先让我说我是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').
Run Code Online (Sandbox Code Playgroud)
他们可能都是相关的,但经过一些搜索,我不知道问题是什么.有什么建议?
错误说明了一切.你有一个res文件夹,你的资源就像字符串/图像/布局可以驻留.所以你引用资源但它们不存在.就像你引用about_label字符串但在你的字符串xml中没有标签string about_label及其value.See res-> strings.Check所有的xml文件,并将您尝试使用的资源放在程序中
小智 6
对于字符串错误,您必须在res/values/strings.xml文件中定义字符串,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="main_title">My Main Title</string>
</resources>
Run Code Online (Sandbox Code Playgroud)
其他错误类似.资源未在res文件夹中定义.
| 归档时间: |
|
| 查看次数: |
27368 次 |
| 最近记录: |