1

This is one of the implementations that I have the most difficulty in actually finding the best way to solve. There are a lot of techniques and ways, but the last answers I found did not really seem to me to solve the problem. Another point is that they are usually very old techniques and libraries.

What I want to do is this:

enter image description here

How do I create this ListView with a GridView inside and the screen has infinite height without using ScrollView, so we know that it is not recommended to use ListView within ScrollView.

I am not asking you to develop the code, but rather recommend me the correct architecture that I should use to implement this (ScrollView, ListView, GridView), or memo a library that has new development concepts that can help me.

This question arises because many of the existing responses are too old and have outdated ideas.

I know the question is of a slightly higher level of complexity, but I accept everyone's help. Thank you very much.

2
  • A single RecyclerView can do this. You'd need a GridLayoutManager and a separate ItemsViewHolder & HeaderViewHolder
    – Jahnold
    Apr 18, 2017 at 19:37
  • Your Adapter views hold the GridView as well as headers. And you alternate "headers" and "grids" simply checking if the position is even. Have you tried this yet? Apr 18, 2017 at 19:39

1 Answer 1

2

It is very easy to solve this using a RecyclerView. The documentation is pretty clear and explains all the details necessary for the development of the functionality.

I will leave the necessary documentation links to implement:

We know that it is always better to use native components in the development, I recommend, but if you prefer to use a library ready to solve your problem, here are some interesting:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.