I have a horizontal recyclerview inside the AppBarLayout, which is inside the CoordinatorLayout, which is inside the SwipeRefreshLayout. I want that when I move horizontally in recyclerview it can't if the user accidentally pulls down to do a refresh. I tried nestedScrollingEnabled = false, but it doesn't help
Asked
Active
Viewed 102 times
-1
-
1Please attach the code of what you have tired – Nitish Sep 21 '21 at 09:47
-
For debugging questions like this, a [mre] would be helpful. – Ryan M Sep 23 '21 at 05:37
1 Answers
0
Take the horizontal recyclerview out of the appbar layout. then set this code for swipe refresh layout:
appbarDetails.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset ->
swipeRefresh.isEnabled = verticalOffset == 0
})
swipe refresh it is only active when the screen is on top

Alireza Abbasian
- 99
- 4