Android 在此行找到多个批注

Android 在此行找到多个批注,android,android-layout,Android,Android Layout,在此行找到多个批注:-错误:分析XML时出错:document元素之后的垃圾文档中根元素后面的标记必须格式正确 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_w

在此行找到多个批注:-错误:分析XML时出错:document元素之后的垃圾文档中根元素后面的标记必须格式正确

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.example.onyourcar.MainActivity"
        tools:ignore="MergeRootFrame" />

    <TextView
        android:id="@+id/hello"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world"
        tools:context=".MainActivity" />


默认的texview是这样的

 <TextView
        android:id="@+id/theTextViewIdHere"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

并尝试使用相对/线性布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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" >

    <TextView
        android:id="@+id/hello"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world" />

</RelativeLayout>

如果您想使用FrameLayout,请点击google示例代码

我对你的问题的第一个猜测是“工具:上下文”的最后一行,试着删除这一行。如果这不起作用,请发布整个XML文件


希望这会有所帮助。

请发布完整的XML。错误似乎不在您的文本视图中,请发布重新启动。实际上,我是一名自学者,我正在尝试创建一个新id,以便我可以看到应用程序的效果。是否关闭此FrameLayout标记?这是您的全部xml内容吗?是的,这是我的全部xml如果我删除“工具:上下文”,我有一个错误:文档中根元素后面的标记必须格式正确。我还建议您需要用谷歌搜索相对布局和线性布局之间的区别。