BottomSheet with RecyclerView - android

I have a RecyclerView (A). When I select an item a second RecyclerView(B) appears as BottomSheet. The problem is when I scroll the RecyclerView B I can see that the RecyclerView A is scrolling too. How can I fix this? The root layout is CoordinayorLayout.

Take a look at example with custom Behavior example

Related

Recyclerview grid layout: Drag outside incompatible with scrolling?

I am building an android app with two recyclerviews, one with horizontal LinearLayoutManager and the other one with GridLayoutManager.
I want to allow the items recyclerviews to be dragged and dropped over a trash icon outside of the recyclerviews, obviously to delete the dragged item.
What I have done is:
Apply android:clipChildren in the parent of the two recyclerviews
Apply android:clipToPadding in the recyclerviews
This works perfectly in recyclerview with LinearLayoutManager. I can drag an item and drop it over an icon that is outside of the recylcerview.
I also works in the recyclerview with GridLayoutManager, but with a side effect. When I scroll in the grid recyclerview the scrolled items come out of the recyclerview.
At the ende of this GIF you can see the scrolling issue
So, Is there any way to allow dragging a recyclerview item outside of the recyclerview boundaries but preventing items comeout when scrolling?
Lots of thanks for your help and suggestions in advance
I tried putting the recyclerview with LinearLayoutManager on top of the recyclerview with GridLayoutManager, to hide the items which came out of the boundaries, but this make a strange behaivour when I drag an item, because the items are there yet, even they are hidden. I could make a GIF if needed
My last option is putting the trash icon inside of the recyclerview, as a header that appears when dragging an item, but I would prefer not do it that way
Finally what I have learnt is that you have two main options when face a drag and drop problem:
Easy way: Using the Android helper ItemTouchHelper
Hard way: Not using the helper and type all the code, using startDragAndDrop()
A scenario like this only can be solved by the hard way.

RecyclerView - how to animate view visibility?

I am looking for way to change view visibility (from gone to visible) inside RecyclerView.
I tried to add android:animateLayoutChanges="true" to my ConstraintLayout (root of RecyclerViews items) and change programmatically visibility of its child.
It works quite well, but first few items are weird - I mean that they completely disappear and show once again instead of animating only visibility of one view. Rest of them are good.
Is there any solution? Do you need any additional informations?
Thanks for help!
You can set a default ÌtemAnimator to your RecyclerView
your_recycler_view.setItemAnimator(new DefaultItemAnimator());

Show View below RecyclerView after scrolling all items down

I have RecyclerView which contains Users and I need button "Add user" at the bottom of RecyclerView (should looks like last item of RecyclerView and must be scrollable).
What is the best way to achieve this? Add new itemViewType to my Adapter? Or maybe there is more simple way with CoordinatorLayout (to scroll view below RecyclerView after one was scrolled all items down, if it is possible)? Second way is really convenient to show scrollable headers with RecyclerView.
In this case you should add another ViewType with its ViewHolder. Here is a link to an answer where everything is explained https://stackoverflow.com/a/26245463/6329985

Make RecyclerView + Button scrolling it one piece// Not showing all items with disabling nestedScrolling

Beneath my RecyclerView is a Button. The RecyclerView´s height is set to wrap_content, so when there are a lot of items it takes the full screen and when scrolling to the bottom the Butten is not visible.
I solved this with wrapping these two views inside a ScrollView. This works almost but when scrolling to the button and then up again the RecyclerView start to scroll first while the button is still on the screen. So I needed to disable the scrolling from the RecyclerView itself. I solved this with setting android:nestedScrollingEnabled="false"
.
This seems to work but now I have another problem. When having a lot of items the RecyclerView does not show all items only the first few items. This happens with disabling nestedScrolling, when I turn it back on it displays all items again but then I have the previously explained problem.
Any ideas what I can do?
In case anyone is having the same problem: The solution is to use NestedScrollView instead of ScrollView

RecycleView inside BottomSheet overriding scroll property

I have one RecyclerView inside Bottom Sheet and I don't want recyclerview to be scrollable inside it. But here I am facing a problem that Bottom Sheet expand and Collapse swipe property interfere with Recyclerview scroll and nothing is happening when I swipe. Please help me to solve this issue.

Categories

Resources