Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Grid View with Row span and Column span

i am trying to implement a grid view which has the Graphical view as follows. I have gone through various blogs and S.O questions, and unfortunately i am not able to provide a row and column span to one particular grid item and grid view also does not support this feature. And i don't want to create Dynamic Scroll View with other views in between as the there is a lot of data and it causes performance issues. So if any one have any suggestions. Please reply . Thanks in advance. enter image description here

like image 863
Karan_Rana Avatar asked Jan 21 '13 15:01

Karan_Rana


2 Answers

Here's the solution to all your problems: https://github.com/felipecsl/AsymmetricGridView Yeah, I got tired of Android not having a class like this and wrote it myself. Hope it is useful for you.

like image 138
Felipe Lima Avatar answered Sep 20 '22 01:09

Felipe Lima


Do you intend to repeat the pattern for your scrollable view? To be more clear, does your Grid item with large span repeat at regular intervals?

One option would be to use a list view and implement your large span view with two normal views as one row of the list view with a tag such as "special_row" and implement regular views as another row with tag like "normal row". Based on the requirement you can recycle the rows by accessing the row tags.

EDIT:

I found a library that implements pinterest like UI for android. This has a symmetric views in it. Checkout PinterestLisView.

EDIT:

Here is another interesting technique by specifying coulmn span and row spans for the grid items. I took from this question. I guess you can do away with the static xml declaration of grid items by programmatically specifying column and row spans.

like image 39
Supreethks Avatar answered Sep 20 '22 01:09

Supreethks