使用scrollview在单页屏幕中显示两个列表视图 [英] Display two list view in single page screen using scrollview

查看:82
本文介绍了使用scrollview在单页屏幕中显示两个列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面需要垂直显示两个列表视图。 .i在滚动视图中添加了两个listview以查看所有细节。但是列表视图修正了它的高度,数据显示被包装。例如:一个列表有200个值,另一个列表有100个值。 。 .i需要完全显示所有数据而不包装在单个屏幕中

解决方案

您可以像这样执行xml代码:

< pre lang =XML> < RelativeLayout

xmlns:android = http:// schemas .android.com / apk / res / android

android:layout_width = fill_parent

android:orientation = vertical

android:layout_height = fill_parent

>
< ListView android:id = @ + id / ListView01

android:layout_width = fill_parent

android:layout_height = wrap_content

android:gravity = center_horizo​​ntal

/ >
< ListView < span class =code-attribute> android:id = @ + id / ListView02

android:layout_width = fill_parent

android:layout_height = wrap_content

android:layout_below = @ + id / ListView01

android:gravity = center_horizo​​ntal

/ >
< / RelativeLayout >



同时从这些中收集想法:

如何在Android上的单个活动中使用多个列表视图? - 堆栈溢出 [ ^ ]

android - 如何在一个屏幕中使用两个ListView? - 堆栈溢出 [ ^ ]


I have one page which needs to be display two list view vertically . .i have added two listview inside scroll view to see all the details . .but the listview fixed its height and the data displayin gets wrapped.for ex : one list has 200 values and other having 100 . . .i need to display all the datas fully without wrapping in a single screen

解决方案

You can do your xml code like this:

<RelativeLayout

  xmlns:android="http://schemas.android.com/apk/res/android"

  android:layout_width="fill_parent"

  android:orientation="vertical"

  android:layout_height="fill_parent"

  >
    <ListView android:id="@+id/ListView01" 

        android:layout_width="fill_parent" 

        android:layout_height="wrap_content"

        android:gravity="center_horizontal"

        />
    <ListView android:id="@+id/ListView02" 

        android:layout_width="fill_parent" 

        android:layout_height="wrap_content"

        android:layout_below="@+id/ListView01"

        android:gravity="center_horizontal"

        />
</RelativeLayout>


Also gather ideas from these:
How to use multiple listviews in a single activity on android? - Stack Overflow[^]
android - How to use Two ListView in one screen? - Stack Overflow[^]


这篇关于使用scrollview在单页屏幕中显示两个列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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