Nilzor Nilzor - 4 months ago 10
Android Question

How do I make RecyclerView update its layout?

I have a

RecyclerView
with a bunch of custom views which may change height after a while, because they contain
ImageView
s 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"
.

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

Answer

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'
Comments