I have a recycler view inside a ScrollView. I want to disable the recycler view scroll so that it listens to its parent layout, A ScrollView!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Logically, it is not a good idea to put ListView
inside a ScrollView
. However, if you insist then:
- You may either increase the
ListView
height based on the sum of its rows height as mentioned here. - Or let the recycling in place but intercept the touch on
ListView
to redirect scrolling to its parent ScrollView as mentioned here.
回答2:
This should solve your RecyclerView nested scrolling.
mRecyclerView.setNestedScrollingEnabled(false);
RecyvlerView implements NestedScrollingChild
for instance if RecyclerView parent is a ScrollView or ListView or RecyclerView or any AbsListView
disable scrolling for the child RecyclerView.