如题,我需要把屏幕分成4部分。每一部分中都有一个ListView,做了很多次都是错误~
希望大侠们~~帮帮我呀~~最好把代码贴出来~~

解决方案 »

  1.   

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <LinearLayout
         android:id="@+id/linear1"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        >
        <TextView
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="fisrt line"
         android:background="#00aa00"
         />
        <ListView
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:background="#0000aa"
         />
    </LinearLayout>
    <LinearLayout
         android:id="@+id/linear2"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_margin="@id/linear1"
        >
        <TextView
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="second line"
         android:background="#00aa00"
         />
        <ListView
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:background="#0000aa"
         />
    </LinearLayout>
    <LinearLayout
         android:id="@+id/linear3"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_margin="@id/linear2"
        >
        <TextView
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="third line"
         android:background="#00aa00"
         />
        <ListView
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:background="#0000aa"    
         />
    </LinearLayout>
    <LinearLayout
         android:id="@+id/linear4"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_margin="@id/linear3"
        >
        <TextView
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="fourth line"
         android:background="#00aa00"
         />
        <ListView
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:background="#0000aa"
         />
    </LinearLayout>

        
    </LinearLayout>结贴是种美德