Java 抽屉布局-文档中根元素后面的标记必须格式正确

Java 抽屉布局-文档中根元素后面的标记必须格式正确,java,android,xml,Java,Android,Xml,我收到一个错误,说明根元素后面的文档中的标记必须格式正确。我不确定为什么会发生这种情况——我相信我已经正确地格式化了所有内容 XML: android.support.v4.widget.DrawerLayout是您的最外层父视图,因此您只需在文件末尾关闭,所有子视图必须放置在您的android.support.v4.widget.DrawerLayout中 试试这个: <?xml version="1.0" encoding="utf-8"?> <android.suppo

我收到一个错误,说明根元素后面的文档中的标记必须格式正确。我不确定为什么会发生这种情况——我相信我已经正确地格式化了所有内容

XML:


android.support.v4.widget.DrawerLayout
是您的
最外层父视图
,因此您只需在文件末尾关闭,所有
子视图
必须放置在
您的
android.support.v4.widget.DrawerLayout

试试这个:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <!-- The navigation drawer -->

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#111"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp" />



<com.google.android.youtube.player.YouTubePlayerView
    android:id="@+id/youtubeplayerview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
<com.idg.omv.ui.widget.VideosListView
    android:id="@+id/videosListView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="70dip"
    android:layout_alignParentBottom="true" >

    <HorizontalScrollView
        android:id="@+id/groupScrollView"
        android:layout_width="fill_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:id="@+id/selstation_up_btn"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:background="@color/darkgrey"
            android:scaleType="fitXY"
            android:src="@drawable/selstation_up_btn" />
    </HorizontalScrollView>

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:src="@drawable/scroll_lt_arrow" />

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:src="@drawable/scroll_rt_arrow" />

    <android.support.v4.view.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout><RelativeLayout>

</RelativeLayout>

</android.support.v4.widget.DrawerLayout>


我添加了它-我仍然收到相同的错误红色X在这行:@user3063132您应该更好地格式化您的xml,这是一堆乱七八糟的垃圾。查看您的xml,您可以清楚地看到您的一些标记没有匹配的结束标记
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <!-- The navigation drawer -->

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#111"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp" />



<com.google.android.youtube.player.YouTubePlayerView
    android:id="@+id/youtubeplayerview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
<com.idg.omv.ui.widget.VideosListView
    android:id="@+id/videosListView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="70dip"
    android:layout_alignParentBottom="true" >

    <HorizontalScrollView
        android:id="@+id/groupScrollView"
        android:layout_width="fill_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:id="@+id/selstation_up_btn"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:background="@color/darkgrey"
            android:scaleType="fitXY"
            android:src="@drawable/selstation_up_btn" />
    </HorizontalScrollView>

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:src="@drawable/scroll_lt_arrow" />

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:src="@drawable/scroll_rt_arrow" />

    <android.support.v4.view.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout><RelativeLayout>

</RelativeLayout>

</android.support.v4.widget.DrawerLayout>