简体   繁体   English

嵌入在滚动框架中的Android listview

[英]Android listview embedded within scrolling frame

I have seen a lot of talk about not putting ListView in ScrollView, but without the ScrollView I cannot see how I can achieve what I want. 我已经看到了很多关于不在ListView中放入ScrollView的讨论,但是如果没有ScrollView,我将看不到如何实现我想要的。

I have a Frame that will display subsets of user information. 我有一个框架,将显示用户信息的子集。 Eg name, age, location, photos... one of the pieces of information is a list of all products the user is subscribed to, which will obviously have a dynamic size depending on how many items. 例如名称,年龄,位置,照片...信息之一是用户已订阅的所有产品的列表,显然,该产品的动态尺寸取决于多少个商品。 I want this to be a list within the scrollviewer, I dont want the list to separately scroll, just to be initialised to it's full size within the scrollviewer so all scrolling is handled at the parent scrollview level, then you can click on an item in the list to be taken to the sub page for that item. 我希望这是滚动查看器中的列表,我不希望列表单独滚动,只是要在滚动查看器中初始化为它的完整大小,以便所有滚动都在父滚动视图级别进行处理,然后可以在其中单击一个项目。要带到该项目子页面的列表。

If I put the ListView outside the ScrollView, I will get two separate indepedently scrolling areas of the screen which I do not want. 如果将ListView放在ScrollView之外,我将得到两个不需要的独立的独立滚动区域。

How can I achieve this? 我该如何实现?

您应该设置listview的高度,但要说它的大小是动态的。您可以获取视图项目,然后测量项目的高度,使listview的高度适合项目的总高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM