Two RecyclerViews under each other in one layout

前端 未结 7 888
不知归路
不知归路 2020-12-13 18:21

How can I get two RecyclerViews under each other in one layout? I don\'t want to have a single RecyclerView for all items. My code:



        
7条回答
  •  被撕碎了的回忆
    2020-12-13 18:55

    I've found the answer myself.

    You need to put the LinearLayout into a ScrollView and use wrap_content as RecyclerView's layout_height.

    
    
    
    
        
    
        
    
        
    
        
    
    
    

    Also there is a bug with with RecyclerView and wrap_content so you have to use a custom layout manager. Check out this post: How do I make WRAP_CONTENT work on a RecyclerView

提交回复
热议问题