Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different Rowheights in Android GridView or equivalent [closed]

is there a way to implement the following feature in my app? Should have a Gridview like behavier, but with different rowheights. Or is there another wigdet, which provide such a feature? (Adapter, n-columns, etc) I spent the last 3 days with trying and catching but i didn't get any matching solution

Wanted Behavier

like image 846
tobi.g Avatar asked Nov 14 '22 09:11

tobi.g


1 Answers

In the layout.xml, use a Linear Layout first, with horizontal orientation.

Within this linear layout, put 4 linear layouts, with vertical orientation, setting the weight attribute to 1 for all of them. (So that each of the column occupies same space).

Now, each of the four linear layouts, put the image view's or buttons and give the weight accordingly. So if the weight is 1, 1, 2 for 3 buttons in a linear layout, the 3rd button size appears twice the size of first or second.

So this will surely solve your problem. But this is only true when you have static no. of levels. You need to make it generic based on the no. of levels, and still it will work.

Let me know if you have any questions.

Nithin

like image 98
nithinreddy Avatar answered Nov 16 '22 03:11

nithinreddy