横向滚动整个列表 [英] Scroll entire list View horizontally

查看:172
本文介绍了横向滚动整个列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含14个字段的自定义列表视图.

I have a custom list view which contains 14 fields.Something like this:

字段1字段2字段3字段4字段5字段6字段7字段8字段9字段10字段11字段12字段13字段14.现在明显的问题是,我不可能适应屏幕上的所有字段,因此我想使整个列表视图水平滚动,因此我只能显示5-6个字段,而当用户水平滚动时,将能够看到其余的人.我可以有一个可以垂直和水平滚动的列表视图吗?

field1 field2 field3 field4 field5 field6 field7 field8 field9 field10 field11 field12 field13 field14. Now the obvious problem is that is no possible way i can fit all the fields on the screen,so i would like to make the entire list view scroll horizontally,so i could display only 5-6 fields,and when the user scrolls horizontally he will be able to see the rest of them. I is possible to have a list view that scrolls both vertically and horizontally?

推荐答案

只需在水平滚动视图内创建列表视图,框架如下所示

simply create list view inside the horizontal scroll view, skeleton as follows

<HorizontalScrollView ...........>
    <LinearLayout ......>
        <LinearLayout ......>
        //List View Titles will be here
        </LinearLayout>

        <ListView ........ android:layout_weight="1" />

    </LinearLayout>
</HorizontalScrollView>

在这里,如果您需要在列表视图中显示不可滚动的标题,请按照上述方式将其添加到单独的布局中,并且不要忘记设置 layout_weight 属性.

Here, If you need to show non-scroll-able title to list view then add it in separate layout as like mentioned and don't forget to set layout_weight attribute.

这篇关于横向滚动整个列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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