当前位置: 代码迷 >> Android >> 怎么在一个界面使用多个listview
  详细解决方案

怎么在一个界面使用多个listview

热度:117   发布时间:2016-05-01 22:17:36.0
如何在一个界面使用多个listview
如题,小弟在布局文件里面放了几个listview,发现它们被覆盖了,始终只显示一个Listview,这是为什么?
这个是小弟的布局文件,不知道有没有问题。
XML code
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:background="@color/black"    android:orientation="vertical" >    <ScrollView        android:id="@+id/ScrollView"        android:layout_width="fill_parent"        android:layout_height="fill_parent" >        <LinearLayout            android:layout_width="fill_parent"            android:layout_height="fill_parent"            android:orientation="vertical" >            <LinearLayout                android:id="@+id/LinLayout1"                android:layout_width="fill_parent"                android:layout_height="wrap_content" >                <ListView                    android:id="@+id/List1"                    android:layout_width="fill_parent"                    android:layout_height="fill_parent" >                </ListView>            </LinearLayout>            <LinearLayout                android:id="@+id/LinLayout2"                android:layout_width="fill_parent"                android:layout_height="wrap_content"                android:layout_below="@+id/LinLayout1" >                <ListView                    android:id="@+id/List2"                    android:layout_width="fill_parent"                    android:layout_height="fill_parent"                    android:layout_below="@+id/List1" >                </ListView>            </LinearLayout>            <LinearLayout                android:id="@+id/LinLayout3"                android:layout_width="fill_parent"                android:layout_height="wrap_content"                android:layout_below="@+id/LinLayout2" >                <ListView                    android:id="@+id/List3"                    android:layout_width="fill_parent"                    android:layout_height="fill_parent" >                </ListView>            </LinearLayout>            <LinearLayout                android:id="@+id/LinLayout4"                android:layout_width="fill_parent"                android:layout_height="wrap_content"                android:layout_below="@+id/LinLayout3" >                <ListView                    android:id="@+id/List4"                    android:layout_width="fill_parent"                    android:layout_height="fill_parent" >                </ListView>            </LinearLayout>            <LinearLayout                android:id="@+id/LinLayout5"                android:layout_width="fill_parent"                android:layout_height="wrap_content"                android:layout_below="@+id/LinLayout4" >                <ListView                    android:id="@+id/List5"                    android:layout_width="fill_parent"                    android:layout_height="fill_parent" >                </ListView>            </LinearLayout>            <LinearLayout                android:id="@+id/LinLayout6"                android:layout_width="fill_parent"                android:layout_height="wrap_content"                android:layout_below="@+id/LinLayout5" >                <ListView                    android:id="@+id/List6"                    android:layout_width="fill_parent"                    android:layout_height="fill_parent" >                </ListView>            </LinearLayout>        </LinearLayout>    </ScrollView></LinearLayout>
  相关解决方案