android - 带有nestedscrollview的嵌套RecyclerView不滚动
问题描述
我有一排在另一个recyclerview中有一个recyclerview,就像这张图片
我需要内部 recyclerview 才能滚动它,我已经尝试过了(这是在 ConstrainLayout 内)
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="150dp"
android:fillViewport="true"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_items"
android:layout_width="match_parent"
android:layout_height="0dp" />
</androidx.core.widget.NestedScrollView>
和
rv_order_items.isNestedScrollingEnabled = true
但我无法在内部回收视图中滚动,有什么建议吗?
解决方案
请在这篇文章中添加整个布局代码,以便我了解约束布局。
否则,如果您想全屏滚动,这是解决方案...
请设置
android:layout_height="match_parent"
NestedScrollView<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
推荐阅读
- typescript - 输入字符串 | 即使在 if-checks 和 null 断言之后 null “可能为 null”
- amazon-web-services - 在 Amazon Linux 2 上为 Docker 配置静态文件设置以错误结束
- compiler-errors - Solidity 智能合约代码中的预期未知错误 - Remix
- git - 查找 git 分支的提交,这些提交不是樱桃挑选到另一个分支
- elf - 为什么 readelf 报告的符号大小与 objdump 不同
- java - 用于大容量数据的数据摄取管道
- c# - 为什么IDispose模式是这样实现的?
- c++ - c++:不能修改类对象参数
- python - 无法处理 urllib.error.HTTPError: HTTP Error 403: Forbidden even added User-Agent
- sql-server - SSMS 中的不可读字符