How do I make WRAP_CONTENT work on a RecyclerView

后端 未结 19 1836
自闭症患者
自闭症患者 2020-11-22 12:49

I have a DialogFragment that contains a RecyclerView (a list of cards).

Within this RecyclerView are one or more CardVi

19条回答
  •  一个人的身影
    2020-11-22 13:46

    This now works as they've made a release in version 23.2, as stated in this post. Quoting the official blogpost

    This release brings an exciting new feature to the LayoutManager API: auto-measurement! This allows a RecyclerView to size itself based on the size of its contents. This means that previously unavailable scenarios, such as using WRAP_CONTENT for a dimension of the RecyclerView, are now possible. You’ll find all built in LayoutManagers now support auto-measurement.

提交回复
热议问题