Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecyclerView use two different layouts? #38

Open
lpbas opened this issue Dec 4, 2019 · 4 comments
Open

RecyclerView use two different layouts? #38

lpbas opened this issue Dec 4, 2019 · 4 comments

Comments

@lpbas
Copy link

lpbas commented Dec 4, 2019

First of all I would like to thank you fort this amazing library!

In the app I'm building, my layout has a different first item in the RecyclerView, a "header" or "promoted" first item, and the rest of them are a second layout. Is there a way to get Skeleton to mimic this layout?

Imagine the layout where it's a vertical list of articles, and the first article is double the height of the rest of them, and some elements moved around, like the title.

Thank you!

@ethanhua
Copy link
Owner

ethanhua commented Jan 6, 2020

@L4grange yes, you can use loadArrayOfLayouts api instead of load

@mbt925
Copy link

mbt925 commented Mar 2, 2020

Why I can't find such a method?

@InsaneDoggo
Copy link

I use workaround: create another viewType special for loader + two layouts, first - as wrapper/container for Skeleton.bind(View) approach, second - skeleton layout itself.
In adapter's onCreateViewHolder method you need to inflate wrapper layout (as for ussual item), then initialize it via Skeleton.bind.

Note: It's important to initialize skeleton in adapter's onCreateViewHolder, cuz it's called once per viewholder's life, while onBindViewHolder - might be called multiple times (recycling mechanism).

@avinashbanswada
Copy link

Can you explain in detail please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants