使用 Android 的多个 ListView 滚动 [英] Scrolling with Multiple ListViews for Android
问题描述
我完全被这个难住了.我有三个不同的列表需要显示在屏幕上.列表完全有可能超出屏幕底部边缘,因此我需要滚动.
I'm completely stumped on this one. I have three different lists that need to be displayed on the screen. It's completely possible that the lists will extend past the bottom edge of the screen, so I would need scrolling.
我尝试使用 ScrollView
和 LinearLayout
子项,并将我的 ListViews
放入 LinearView
,但是所有的 ListViews
都通过滚动条锁定到一个固定的高度.使用其他类型的布局意味着没有滚动.
I've tried using a ScrollView
with a LinearLayout
child, and putting my ListViews
in the LinearView
, but all of the ListViews
lock to a fixed height with scroll bars. Using other kinds of Layouts means no scrolling.
有没有人有任何建议,或者我是否需要以编程方式将列表项添加到某些布局并希望获得最佳效果?
Does anyone have any suggestions, or will I need to programmatically add the list items to some layout and hope for the best?
推荐答案
我还没有这样做,但我一直在考虑,因为我可能需要这样做.我可以想到三个选项:只使用一个包含所有列表内容的列表.您可以制作一个 ListAdapter 来执行此操作并插入某种标题.这可能是非常可重用的东西.
I haven't done this yet, but I've been thinking about it since I'll probably need to do it. I can think of three options: use only one list with the contents of all lists. You can make a ListAdapter that does that and inserts some kind of header. This could probably be something very re-usable.
另一个想法是制作一个列表列表.但这听起来像是自找麻烦.
The other idea is to make a list of lists. But that sounds like asking for trouble.
这篇关于使用 Android 的多个 ListView 滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!