Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom HorizontalScrollView adapter RecyclerView

I'm trying to create an HorizontalScrollView with a RecyclerView, I have my adapter with FirebaseAdapter with my onCreateViewHolder, onDataChanged and its onBindViewHolder, what I'd like to add on my RecyclerView is something like this Image, something like, user only will see 3 items, and the centered zoomed/bigger, someone told me that I have to override getItemViewType, but I do not know how to, could you guide to how to do it?

To make it act like an HorizontalScrollView I've added a CustomLinearLayout like this :

LinearLayoutManager layoutManager = 
new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
rv.setLayoutManager(layoutManager);

What I'd like it to show is like this (each blank rectangle is an item) :

enter image description here

FOR THOSE WHO DON'T UNDERSTAND

I allready have a RecyclerView which acts like HorizontalScrollView BUT I'm not able to make that customizable, to show it like the image from above.

like image 919
StuartDTO Avatar asked Dec 31 '17 12:12

StuartDTO


1 Answers

Actually this is a popular thing to implement, so the solution already exists on GitHub - https://github.com/yarolegovich/DiscreteScrollView. It's highly customizable, so you can adjust it for your needs and metrics. Here is an example from that lib:

enter image description here

like image 92
romtsn Avatar answered Sep 22 '22 12:09

romtsn