How to delegate scroll of RecycleView to ScrollView - android

I have a RecyclerView inside ScrollView. I want RecyclerView to start scrolling itself only after it reached a top of the screen, and while it isn't it should scroll his parent ScrollView. How to achieve this behavior?

use widget nestedscrollview or
recyclerview scroll display and scrollview enable
recyclerView.setNestedScrollingEnabled(false);

Related

RecyclerView with nested ViewPager2 inside BottomSheet

I have RecyclerView inside BottomSheet. It has different kinds of views inside the rows (TextView, MaterialCardView and ViewPager2). This RecyclerView should not scroll vertically while BottomSheet is in the collapsed state - Bottom Sheet should expand on scrolling instead. And this behaviour works correctly when I touching any row of RecyclerView except one that contains ViewPager2. In case of touching the cell of ViewPager2 RecyclerView just scrolls vertically and expending of BottomSheet doesn't happening.

child recyclerview not scrolling when i put horizontal recyclerview inside another horizontal recyclerview

I have a nested recyclerview and both have a horizontal linear layout but the child one is not scrolling
All consequences
1) I'm using a snap helper in the parent recyclerview
2) also using recycler view pool in child recyclerview
It is bad practice to use a Nested RecyclerView with the same LayoutManager.
If horizontal scrolling is important to use for you then try RecyclerView inside ViewPager.
This will behave like this:
When scrolling RecyclerView, Fragment will stick to port until RecyclerView last item is shown. After that the next fragment switchs.

Horizontal RecyclerView inside ScrollView: how to get focus when vertical scrolling?

I have a ScrollView with multiple horizontal RecyclerView. The problem is this:
When I scroll vertically to navigate into my app and I touch on a recyclerview to scroll horizontally, the focus remain on the scrollview and I can't scroll horizontally. I have to release the finger and touch again in order to scroll vertically. I'd like to give proprity to the recyclerview, so I can scroll horizontally without stopping the vertical scroll.
I tried multiples solutions:
editing some parameters in the xml of the recyclerview and its container (focusable, focusableintouchmode, descendantFocusability,nestedscrollingenabled)
adding an ontouchlistener and intercepting the motionevent, both in scrollview and recyclerview
This problem is present using both ScrollView and NestedScrollview and using both RecyclerView and ListView
Thanks for your help
This problem because of recyclerView has default focus.
Just Add this
android:descendantFocusability="blocksDescendants"
to your immediate layout of scrollView.

Horizontal Recyclerview inside a Vertical Scrollview

I have a situation where I have a Recyclerview which slides horizontally inside a ScrollView. Now the situation is when I do a horizontal swipe on the Recyclerview, instead of scrolling the cardviews inside Recyclerview, it scrolls the screen up, which disturbs the user experience.
Any solution or approach to avoid vertical scrolling when the person is doing a horizontal swipe on Recyclerview?
The solution is actually quite simple.
put the horizontal RecycleView as an item in a RecycleView, instead of using a scrollview.
then when you scroll it behaves as you want it to.
Thats what I did and it works perfectly

how to disable recycler view scrolling so that it listens to Scrollview layout?

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!
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.
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.
Add this line in xml,
android:nestedScrollingEnabled="false"

Categories

Resources