如何将ListView放在两个RelativeLayouts之上

时间:2014-12-12 18:53:07

标签: android android-layout listview orientation relativelayout

如何将ListView放在上面(z-index)这两个RelativeLayouts?如图所示?

<ListView
     android:layout_width="fill_parent"
     android:layout_height="150dp"></ListView>
 <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="100dp"></RelativeLayout>
 <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="100dp"></RelativeLayout>

http://i.stack.imgur.com/NhVub.png

1 个答案:

答案 0 :(得分:1)

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

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ListView
            android:layout_width="wrap_content"
            android:layout_height="150dp" >
        </ListView>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="100dp" >
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="100dp" >
            </RelativeLayout>
        </LinearLayout>
    </FrameLayout>

</LinearLayout>