【发布时间】:2014-11-14 03:11:00
【问题描述】:
这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
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"
<EditText android:id="@+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/edit_message";
</EditText>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send";
</Button>
</LinearLayout>
有一个错误 在第一个 EditText 和第一个 Button 行,第一个错误是标题中的错误,第二个错误是: '元素类型'EditText'必须后跟属性规范,'>'或'/>'
怎么了?整个代码(几乎)完全按照此处所示http://developer.android.com/training/basics/firstapp/building-ui.html
(如果我拼写错误或忘记了什么,我很抱歉,我在这里是菜鸟......)
编辑:谢谢,伙计们,但我尝试将您的代码粘贴到我的代码上。虽然没有 X 标志,但调试工具仍然说有一些错误...
编辑:是的,我有所需的字符串,因为我按照教程进行操作。但我不明白...如果我将教程网站上给出的代码粘贴到 Eclipse 中,仍然会出现错误!我会尝试在另一个程序中打开 .xml。
【问题讨论】:
-
如果您没有相应的字符串,错误也可能来自 android:text。我编辑了我的答案。
-
尝试使用常规 XML 编辑器打开文件,看看它是否告诉您任何信息。