java - 如何允许在单个 Activity 上滚动多个 ListView?
问题描述
我创建了一个 CV 构建应用程序,最后一个 Activity 以 ListViews 的形式显示所有信息。每个 ListView 都有 layout_height=wrap_content 这意味着一旦用户输入了多个先前的作业,数据就会从屏幕上掉下来并且无法滚动。
我已经尝试限制 ListView 使用的空间,使其自己的数据可滚动,但是这在屏幕上看起来不正确。我更希望显示所有数据并使整个屏幕可滚动。有什么建议么?
此外,我不希望用户必须移动到其他活动来查看他们输入的数据。
解决方案
如果使用ScrollView,就可以解决。在您的 layout.xml 文件中,尝试像这样使用 ScrollView 包装所有列表视图。
...
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
...
</ScrollView>
...
如果您不能解决您的问题,请查看此处。
推荐阅读
- dart - ScrollController 如何检测滚动开始、停止和滚动?
- php - 针对不同问题选择不同的单选按钮
- php - 如何按修改日期从 ftp 订单中获取文件列表
- python - Python:没有得到简单的添加结果
- slack - 在 Zapier 中输入什么“用户名”以使其向新的 Slack 用户发送 DM?
- azure-data-explorer - 指定新列名时扩展运算符是否支持空格?
- python - Swift 等价于 Python Dictionary setdefault() 方法
- velocity - 如何在使用速度模板创建动态类时修复“类未找到异常”
- meteor - Meteor 如何在查找集合中添加 findParams?
- apache-royale - 如何从 apache Royale uisng RemoteObject 与 Spring +blazeDS 服务对话