how do i use both scroll view and RecyclerView in one xml layout android?

戏子无情 提交于 2019-12-06 12:54:46

you must know that ,your scrollview property is set as MatchParent ,which means it will fill the content view, so i suggest to set Height a real value such as 100dp, and it will work

You need to dynamically change the height of the recyclerview, depending on how many items you have.

int recyclerheight = height_per_item * adapterData.size();
recyclerView.getLayoutParams().height = recyclerheight;

The scroll view blocks the recyclerview from changing its height set in the xml, that's why you need to do it programically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!