RecyclerView inside ScrollView is not working

前端 未结 26 1518
梦如初夏
梦如初夏 2020-11-22 05:37

I\'m trying to implement a layout which contains RecyclerView and ScrollView at the same layout.

Layout template:


    

        
26条回答
  •  渐次进展
    2020-11-22 06:27

    I was having the same problem. That's what i tried and it works. I am sharing my xml and java code. Hope this will help someone.

    Here is the xml

    
    

    < NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        
    
            
    
            
    
            

    Here is the related java code. It works like a charm.

    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setNestedScrollingEnabled(false);
    

提交回复
热议问题