在一项活动中添加多个列表视图
问题描述:
我要添加多个列表视图像一个应用程序的微博Android版:的链接 但eveytime我尝试添加多个列表视图中的XML和填充它也只是出现的第一个。你有一个解释?
I want to add multiple listview like one app for twitter for android : link But eveytime i try to add multiple listview in the XML and populate it there is just the first one that appear . Do you have an explanation ?
答
试试这个:
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ListView android:id="@+id/list1"
android:layout_height="0"
android:layout_width="fill_parent"
android:layout_weight="1" />
<ListView android:id="@+id/list2"
android:layout_height="0"
android:layout_width="fill_parent"
android:layout_weight="1" />
</LinearLayout>
您可以将任意数量的列表视图中,只要你定义每个的高度为0和1的重量希望有所帮助。玩得开心!
You can put any number of listviews as long as you define the height of each to be 0 and weight 1. Hope that helps. Have fun!