How do I make WRAP_CONTENT work on a RecyclerView

后端 未结 19 1862
自闭症患者
自闭症患者 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:49

    RecyclerView added support for wrap_content in 23.2.0 which was buggy , 23.2.1 was just stable , so you can use:

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

    You can see the revision history here:

    https://developer.android.com/topic/libraries/support-library/revisions.html

    Note:

    Also note that after updating support library the RecyclerView will respect wrap_content as well as match_parent so if you have a Item View of a RecyclerView set as match_parent the single view will fill whole screen

提交回复
热议问题