android - android listView裁剪和无法滚动
问题描述
我有一个带有列表视图的片段文件,随着项目数量的增加,它们会填充到屏幕之外,但我无法滚动列表视图以显示隐藏的项目。大多数教程都遵循 LinearLayout 等,但我想留在现代约束布局模式中。
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/userList"
android:layout_width="409dp"
android:layout_height="729dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
解决方案
这里有一个类似的问题,海报表明它一直运行良好,但需要更多元素来滚动。
如果不是这种情况,请尝试在您的 ListView 中进行设置
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
我还没有测试过,但是有些人报告说成功了,所以试一试。
推荐阅读
- python - 为什么当键确实在列表中时,“mydict 中的键为真”返回 false?
- c++ - 关于打印 STL 容器以进行认可测试的公约
- javascript - vue-chart.js / vuex:当 vuex 状态改变时图表不更新
- postgresql - PostgresSQL 函数需要很长时间
- ubuntu - 如何使用 user@hostname:$ 启动终端
- javascript - 这个元素可能在来自不同 src 的 iframe 内。目前 chropath 不支持它们
- python - 我们可以在 for 循环中声明一个空函数吗?
- rest - 无法对 github 存储库统计信息进行分页
- spring - @ControllerAdvice 未捕获 Rest API 异常
- php - php - fpdf 选择案例 $row