ViewFlipper在相对布局中与另一个相对布局子项一起使用。形式不正确的标记

时间:2013-10-17 15:58:23

标签: android layout relativelayout viewflipper non-well-formed

我得到“ViewFlipper标记附近的根元素后面的文档中的标记必须格式正确”。这个错误的原因是什么?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent"
    android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- storage layout -->

    <View android:id="@+id/gap" android:layout_width="wrap_content"
        android:layout_height="0dip" android:layout_alignParentBottom="true" />

    <RelativeLayout android:id="@+id/storage"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_above="@id/gap" android:layout_marginBottom="10dp"
        android:layout_marginRight="27dp" android:layout_marginLeft="10dp"
        android:layout_toLeftOf="@id/bag" android:orientation="horizontal">

        <ImageButton android:id="@+id/ImageButton02"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_alignTop="@+id/ImageButton01"
            android:layout_marginRight="16dp" android:layout_toLeftOf="@+id/ImageButton01"
            android:background="@drawable/key_stored" android:onClick="zoomImage" />

        <ImageButton android:id="@+id/ImageButton03"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_alignTop="@+id/ImageButton01"
            android:layout_centerHorizontal="true" android:layout_marginRight="16dp"
            android:layout_toLeftOf="@+id/ImageButton02" android:background="@drawable/stool_stored"
            android:onClick="redSplashClicked" />

        <ImageButton android:id="@+id/ImageButton04"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_alignTop="@+id/ImageButton01"
            android:layout_marginRight="16dp" android:layout_toLeftOf="@+id/ImageButton03"
            android:adjustViewBounds="true" android:background="@drawable/bottle_stored"
            android:onClick="redSplashClicked" />

        <ImageButton android:id="@+id/ImageButton05"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_alignTop="@+id/ImageButton01"
            android:layout_marginRight="16dp" android:layout_toLeftOf="@+id/ImageButton04"
            android:adjustViewBounds="true" android:background="@drawable/key_stored"
            android:onClick="redSplashClicked" />

        <ImageButton android:id="@+id/ImageButton06"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_alignTop="@+id/ImageButton01"
            android:layout_marginRight="16dp" android:layout_toLeftOf="@+id/ImageButton05"
            android:adjustViewBounds="true" android:background="@drawable/photo_stored"
            android:onClick="redSplashClicked" />

        <ImageButton android:id="@+id/ImageButton01"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true" android:background="@drawable/bottle_stored"
            android:onClick="store" />
    </RelativeLayout>
    <ImageButton android:id="@+id/bag" android:layout_width="65dp"
        android:layout_height="65dp" android:layout_alignBottom="@+id/storage"
        android:layout_alignParentRight="true" android:layout_marginRight="10dp"
        android:adjustViewBounds="true" android:onClick="redSplashClicked" />
    <ImageButton android:id="@+id/left" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_alignLeft="@+id/storage"
        android:layout_centerVertical="true" android:background="@null"
        android:onClick="previousWall" android:src="@drawable/left" />
    <ImageButton android:id="@+id/right" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_alignRight="@id/bag"
        android:layout_centerVertical="true" android:background="@null"
        android:onClick="nextWall" android:src="@drawable/right" />

</RelativeLayout>

<ViewFlipper android:id="@+id/water_room_flipper"
    android:layout_width="fill_parent" android:layout_height="fill_parent">
    <include layout="@layout/water_room_wall1" android:id="@+id/first" />
    <include layout="@layout/water_room_wall2" android:id="@+id/second" />
    <include layout="@layout/water_room_wall3" android:id="@+id/third" />
    <include layout="@layout/water_room_wall4" android:id="@+id/fourth" />
</ViewFlipper>

</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

我已经想通了。我在视图翻板标签之前放了不必要的关闭标签。其实我已经复制了xml并粘贴了。不知何故,结束标签本身就出现了。