显示多的ListView在一个屏幕 [英] Show multi ListView in one screen

查看:136
本文介绍了显示多的ListView在一个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个ListView和从网站DATABSE每一个获取信息....
一切都很不错,但我想要的是显示第一个列表视图然后在它的第二个列表视图没有设置固定的高度..喜欢的用户应双击自动滚屏首先列表视图的末尾,然后显示第二列表视图,而不显示滚动条。在这里我做了什么:

i have 2 ListView and each one get informations from a website databse.... everything is going fine, but what i want is to show the first listview then under it the second listview without setting a fixed height .. like the user should scrool to the end of first listview and then show the second listview without showing the scroller. here what I have done :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ListView
        android:id="@+id/firstlist"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </ListView>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

    <ListView
        android:id="@+id/secondlist"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
         >
     </ListView>
    </RelativeLayout>

</LinearLayout>

但是屏幕没有显示,即使我一直都滚动,只有一个列表视图(第一批)的出现......除非我给他们固定的高度例如的android:layout_height =180dp什么想法?

推荐答案

我以前有同样的问题。这里有四个解决方案:

I have same issue before. Here are four solutions:

确定公司运作的的android:layout_weight =1每个列表视图,以便他们可以减半屏幕

1.give the android:layout_weight = "1" for each listview so them can halve the screen.

2.put他们在一个TabView的。

2.put them in a tabview.

3.Merge两份名单成一个列表视图。

3.Merge two lists into one listview.

4.使用ExpandableListView

4.Use ExpandableListView

这篇关于显示多的ListView在一个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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