How do I make WRAP_CONTENT work on a RecyclerView

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

    UPDATE 02.07.2020
    This method may prevent recycling and should not be used on large data sets.

    UPDATE 05.07.2019

    If you are using RecyclerView inside a ScrollView, just change ScrollView to androidx.core.widget.NestedScrollView. Inside this view there is no need to pack RecyclerView inside a RelativeLayout.

    
    
        
    
            
    
            
    
            
    
        
    
    
    

    Finally found the solution for this problem.

    All you need to do is wrap the RecyclerView in a RelativeLayout. Maybe there are other Views which may also work.

    
    
        
    
    
    

提交回复
热议问题