简体   繁体   English

将RecyclerView的高度嵌套到“ wrap_content”,其中包含大量物品

[英]Nested RecyclerView's height to “wrap_content” with a large amount of items

I have a RecyclerView nested in a vertical scrolling view. 我有一个嵌套在垂直滚动视图中的RecyclerView The RecyclerView displays items with a vertical LinearLayoutManager . RecyclerView显示带有垂直LinearLayoutManager项目。 Its height is (and has to be, per product specification) set to wrap_content . 其高度(必须根据产品规格)设置为wrap_content

Problem is memory and performance issues come around quickly when I set a large amount (~50+) because items are simply not recycled. 问题是当我设置大量(〜50 +)时,内存和性能问题很快就会出现,因为项目根本就没有回收。

What is the good way to make this work nicely and smoothly? 使此工作顺利顺利进行的好方法是什么?

Edit: Ok, some more details. 编辑:好的,还有更多细节。

I have to make screen that describes a TV show: the synopsis, the list of seasons, and for each season the list of episodes. 我必须制作一个描述电视节目的屏幕:提要,季节列表以及每个季节的情节列表。 The list of episodes for each season must not be collapsed/folded/shrinked. 每个季节的剧集列表都不能折叠/折叠/缩小。

This is what I have to achieve: 这是我必须实现的:

在此处输入图片说明

The problem is, that you have a scrolling view inside a scrolling view. 问题是,您在滚动视图中有一个滚动视图。 Apply recyclerView.setNestedScrollingEnabled(false) to your RecyclerView . recyclerView.setNestedScrollingEnabled(false)应用于您的RecyclerView

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

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