I need a GridView with rows with different height. Only for rows, not for items inside a row. In a row the items have the same height.
I already tried to do that with Android’s GridView but got strange things. The grid distorts when scrolling up and down and at some point, when scrolling up, it dissapears. If I put all rows with the same height, it works, but as soon as they are a bit different, the problem appears.
So it seems I have to make a custom view. It has to have very good performance and low memory usage. Would be enough to extend, for example, Relative Layout, and put all my items with certain top and left margin? Or do extend View and draw directly to the canvas? Or a Scroller?
Embedded question: Will this, (maybe it depends if I extends some Layout or directly View), manage to load only the things which appear on the screen (the list is very long and I don’t want all the objects in memory at once) or do I have to implement this myself?
Thanks in advance!
I don’t think you can do it and get “good performance”. What makes Android efficient is it’s recycling of views. With different row heights from row to row, I don’t know how it could recycle views in any sort of efficient manner (or at all).
I guess it depends on if the row height differences are known/knowable and how many there would be and if they would be in any pattern that could be predicted so you could set a custom adapter to handle the view recycling.
If you can determine the above, then extending an adapter and handling the view recycling yourself is probably the answer.