RecyclerView inside ScrollView is not working

前端 未结 26 1969
梦如初夏
梦如初夏 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:15

    Although the recommendation that

    you should never put a scrollable view inside another scrollable view

    Is a sound advice, however if you set a fixed height on the recycler view it should work fine.

    If you know the height of the adapter item layout you could just calculate the height of the RecyclerView.

    int viewHeight = adapterItemSize * adapterData.size();
    recyclerView.getLayoutParams().height = viewHeight;
    

提交回复
热议问题