Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gridview disappear?

Tags:

android

Am using gridview to display an image and a textview.

After implementing this,

1) some times the alignment seems to be dancing while moving the gridivew 2) Some times the gridview get disappeared.

Can u plz advise how to resolve it ?

Thanks in advance.

like image 203
Prasath Avatar asked Feb 22 '11 06:02

Prasath


2 Answers

@Prasath, Set the Layout params for your images in Grid view. Your issue will be resolved. Since Grid view has issue with scrolling of uneven height objects. That's why your GridView disappears.

like image 158
Piyush Avatar answered Oct 04 '22 19:10

Piyush


https://stackoverflow.com/a/5958097/2188257 this solution partialy solved the problem for me. When you set a fixed number of lines for the textview inside gridItems it doesnt fall apart anymore, but then you get the problem of having fixed number of lines for the text. its a problem cause i would like to reuse the layout for a grid menu on more than one place, and in some i have grids with big labels with 4-5 lines, and in a main menu labelshave just one line, but have to have 5 fixed lines because of other grids. I guess the solution could be to measure each element in the adapter and later setting layoutParams for the grid with max values... or creating multiple xml files for different uses of the grid.

like image 31
Tomislav3008 Avatar answered Oct 04 '22 19:10

Tomislav3008