这是我的第一个android项目,我无法调试此培训应用程序Building a Simple User Interface

当我调试运行时,我看到了:


  XML文件中的错误:正在中止构建。


(适用于android: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"

<EditText android:id="@+id/edit_message"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:hint="@string/edit_message" />
<Button
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:text="@string/button_send"

</LinearLayout>

最佳答案

您没有关闭<LinearLayout><Button>标记。甚至StackOverflow语法突出显示也表明了这一点。尝试这个:

<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_height="wrap_content"
    android:layout_width="wrap_content"
    android:hint="@string/edit_message" />

<Button
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:text="@string/button_send" />

</LinearLayout>

关于android - 我的Android项目中的XML文件错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17656241/

10-11 22:29
查看更多