在一项活动中添加多个列表视图 [英] add multiple listview in one activity

查看:109
本文介绍了在一项活动中添加多个列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要添加多个列表视图像一个应用程序的微博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!

这篇关于在一项活动中添加多个列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆