如何使RecyclerView更新其布局? [英] How do I make RecyclerView update its layout?

查看:57
本文介绍了如何使RecyclerView更新其布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RecyclerView,其中包含一堆自定义视图,这些视图可能会在一段时间后更改高度,因为它们包含ImageView,这些异步地加载其图像.尽管我在ImageView上调用了forceLayout,并且RecyclerViewsetHasFixedSize(false)初始化了,但RecyclerView并未适应这种布局更改. ImageView的所有容器父级都设置了android:layout_height="wrap_content".

I have a RecyclerView with a bunch of custom views which may change height after a while, because they contain ImageViews which load their image asynchronously. The RecyclerView does not pick up on this layout change, although I call forceLayout on the ImageView, and the RecyclerView is initialized with setHasFixedSize(false). All container-parents of the ImageView have set android:layout_height="wrap_content".

如何使RecyclerView更新其布局?使用good'ol ListView,这不是问题.

How can I make the RecyclerView update its layout? With good'ol ListView this was not a problem.

推荐答案

Google终于在

Google has finally fixed this in support library v23.2. Issue is fixed by updating this line in build.gradle after updating your support repository with the SDK Manager:

compile 'com.android.support:recyclerview-v7:23.2.0'

这篇关于如何使RecyclerView更新其布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆