Android 在这一行找到多个注释:-根元素后面的文档中的标记必须格式良好
我不熟悉编码,非常想学习。Android 在这一行找到多个注释:-根元素后面的文档中的标记必须格式良好,android,xml,parsing,r.java-file,Android,Xml,Parsing,R.java File,我不熟悉编码,非常想学习。 我在developer.android.com网站上自学。 不幸的是,我陷入了泥潭,无法通过此代码。 请帮忙。我做错了什么? 如果您想查看此练习,请访问以下地址: 您的问题在这里: <LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:lay
我在developer.android.com网站上自学。
不幸的是,我陷入了泥潭,无法通过此代码。
请帮忙。我做错了什么?
如果您想查看此练习,请访问以下地址:
您的问题在这里:
<LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" />
这将关闭线性布局标记。应该是这样的:
<LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
without the closing /
您需要在应用程序的字符串资源中定义此值。以下内容摘自
定义你的价值观,这样一切都应该固定。谢谢你的回答。我不是在使用linux。我有windows。我对这部分仍然有一个问题:您的实际问题是什么?您是否定义了要引用的@String参数?否则,您的问题中的代码是正确的。我不断得到“在这一行找到多个注释:-错误:错误:找不到与给定名称匹配的资源(在'hint'处,值为'@string/edit_message')。”这一特定代码块。它起作用了!谢谢正如你所说,我必须建立资源。
/>
<LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
without the closing /
@String/edit_message
FILE LOCATION:
res/values/filename.xml // in oyur case this will likely be Strings.xml
The filename is arbitrary. The <string> element's name will be used as the resource ID.
COMPILED RESOURCE DATATYPE:
Resource pointer to a String.
RESOURCE REFERENCE:
In Java: R.string.string_name
In XML:@string/string_name
SYNTAX:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name="string_name" // in your case this will be name="edit_message"
>text_string</string>
</resources>
/res/values/strings.xml