AdvancedRecyclerView | An easy , empowering Kotlin library for RecyclerView | RecyclerView library
kandi X-RAY | AdvancedRecyclerView Summary
kandi X-RAY | AdvancedRecyclerView Summary
Before the appearance of RecyclerView, ListView and GridView were the common layout used to display lists of items. Even though RecyclerView has optimized how to render list of items without having to worry how you want to display them (either list or grid) it comes with a price when implementing such behaviors.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AdvancedRecyclerView
AdvancedRecyclerView Key Features
AdvancedRecyclerView Examples and Code Snippets
Community Discussions
Trending Discussions on AdvancedRecyclerView
QUESTION
I am designing a relatively complex UI, i have searched stackoverflow and haven't found similar design. There could be many approaches to this, but i would like to ask expert opionions on how to achieve this and i would like to share my approach and make sure i am doing it the right way. My approach is that i have created a recycleview with header and inside header recycleview i am using an expandable recycleview library developed by h6ah4i (taken from github). Please let me know if there's a better approach to this.
The following image preview is a live mockup of final result i would like to get. It's not the actual screen. My question is what is the best way to achieve this, should i use expandable recycleview or expandable listview in recycleview header. I appreciate any answer as approaches or libraries it doesn't have to be similar to my code. Any suggestions are welcomed. I hope this post will also help other people like me in search of similar solution.
RecycleView Adapter
...ANSWER
Answered 2020-Oct-06 at 12:44You were right to search a library that does most of the work for you, but I don't like the library you picked. It does not seem very flexible and concise. I suggest to take a look at Groupie, its API is pretty clean. Also check Reddit for some discussion on libraries.
If you want to write it yourself I think you can solve it without nested Adapter
's. Just create an 'expandable group' item type. Then in getItemCount()
you count all items and their nested items (when expanded). Take a look at the Groupie source code.
Some additional feedback on your code:
- I would explicitly add the header to the list of items you give to your adapter. So instead of a
List
, you rather provide aList
and have aHeaderItem
andPlantsItem
. This way you have a clear separation between your domain models (Plants
) and view models (the items) in your adapter. - Your
onBindViewHolder()
method does way too much. Let yourViewHolder
subclasses take care of that. Create an abstractViewHolder
with an abstractbindTo(Item item)
method. Then in yourHeaderViewHolder
subclass it and do the actual work (after an instanceof check). - Have a look at view binding, it can make your code more concise. (So does Kotlin.)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AdvancedRecyclerView
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page