多个根标签错误

Multiple root tags error

我是 Android 开发和编程的新手。我尝试编写一些布局代码,但我得到了

Multiple root tags error

谁能帮帮我?

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="This is my first android app!" />

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Button!" />

</LinearLayout>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Hello!" />

    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="This is my first android app!" />

    <Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Button!" />

</LinearLayout>

我能够通过这种方式修复它,但是如果在第一个 TextView 文本中我输入“@string/Hello”,它就不起作用,有人能告诉我为什么吗?

试试这个:

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="This is my first android app!" />

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Button!" />

    </LinearLayout>