I want to achieve this kind of horizontal scroll of CardViews using RecyclerView. I know how to make horizontal scroll in RecyclerView. But I want to make the current item big compared to the other side items.
Working video of the demo:
https://i.stack.imgur.com/3aB9q.gif
Static image of the behavior:
How can I achieve the above behaviour ?
Maybe this helps you. SnapHelper with center snapping https://rubensousa.github.io/2016/08/recyclerviewsnap
Related
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.
I have been trying to implement horizontal lists inside a RecycleView and have a working single horizontal list thenks to this answer https://stackoverflow.com/a/45953855, can anyone advise on the required modifications to have multiple horizontal lists based on the provided example?
Cheers
Phil
Take 1 Recyclerview Vertical.
Now inside the cell of the recyclerview place second recyclerview Horizontal.
Now set every recyclerview(vertical) items(cells) with adapter and it will work fine with vertical and horizontal data.
if you find any query, let me know i would help you.
With this link you can navigate to the image of my recyclerview.
Here I have vertical recyclerview inside horizontal recyclerview. The horizontal scrolling works fine because I have used LinearSnapHelper. So everytime I scroll horizontally, one of the displays of date and hours is positioned in the center. The problem is that I want to disable the vertical scrolling of 2 recyclerviews of the image which are on the edges, so the only central recyclerview can be scrolled vertically at that moment.
Looking forward to suggestions!
Thanks in advance!
I would like to help you with your problem
Could you please submit code snippets of your main activity, main XML file, and the activity that this layout is put in?
I want to animate the first image like when I scroll the recyclerview up then it should expand equal to width of the mobile device display and when I scroll down it should collapse. It's kind of expand and collapse the below black background layout when I scroll the recylcerview. How do I do this, any idea? thanks in advance.
Now i have to create a horizontal listview again, this time i want to find a better library for this, as far as i know android did not have a horizontal listview, and then i read this
http://developer.android.com/design/building-blocks/grid-lists.html
They mention if gridview can scroll horizontally, they even illustrated it with a picture. I try to find example of how to use gridview horizontally, but i have no luck,
is anyone here can help me how to use gridview scroll horizontally?
This is the best library for two way grid. I have used it and it works perfectly.
https://github.com/jess-anders/two-way-gridview
I'm end up using recyclerview as #tyczj recommend