It seems that simply using android:layout_height="wrap_content"
on your RecyclerView won’t make its height automatically expand when new items are added in it.
I also tried using recyclerView.setHasFixedSize(false)
in my Kotlin fragment file, but that didn’t help at all. (But try it, maybe our issues are different. The parent of my RecyclerView is a ConstraintLayout.)
What helped was wrapping my RecyclerView (whose height is match_parent
) inside a RelativeLayout (whose height is wrap_content
)
Old Code:
New Code: