0

What I need is something like this:

A single scrollView with 2 type of grids

If I use 2 gridViews, they will scroll separately. So I put 2 gridViews into a vertical LinearLayout, both gridViews have fillViewport set to true, and I put this LinearLayout inside a scrollView. But it doesn't work, the scrollView doesn't scroll to the full extent of the 2nd gridView.

I found this: Gridview height gets cut

Looks this can solve my problem by making the gridView grow its height, but as the comments say, this solution is not memory efficient, as it foregoes the cell recycling, and can cause crashes.

Is there any other better way to implement this?

Community
  • 1
  • 1
NeoWang
  • 17,361
  • 24
  • 78
  • 126

1 Answers1

0

Try ListView with custom items instead. Top grid may be set with setHeaderView method, and bottom grid should be replaced with a set of items to show. This is both default and memory effecient way, it loads only what you show and allows scrolling.

Raiv
  • 5,731
  • 1
  • 33
  • 51