/dynamic-recyclerview

RecyclerView with dynamic items

Primary LanguageJava

I've been in trouble sometimes with RecyclerView when multiple lists are needed to be shown in a single page of the application. IMHO, its not a very good idea to have multiple lists in a single layout, however, the idea of having a ScrollView and the lists inside that ScrollView is worse.

I had to implement a ListView inside a ScrollView once and yes it was not a very good experience. Firstly, my list was not scrolling at all. Then I had to add some code to disable the scrolling when the touch is detected inside the list. It was not a very good idea of solving the actual problem. I had another problem of having a fixed height of the ListView. In case of list items with dynamic heights, the solution failed.

Having two lists in the layout, one after one is not a good idea either. As the first list need to have a fixed height.

So, after searching for suggestions about how can I implement two lists in a single layout file, I found most of the developers suggests of having a single list with a header and footer if necessary. Later, I could manage to show two lists in a single RecyclerView using my custom Adapter. I thought I should save some of my code for future use and hence, you see this note.

I'm just adding a simple mockup screen to make it clear about what we're trying to achieve. You'll have the detailed description of the walk-through in the wiki section of this project.

To run the project

You need to have Android Studio along with the Android SDK installed in your machine. To download and install please follow the link here.

After installing Android Studio, you just have to Import the project -> Build -> Run.