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.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
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.
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.
This is a particular solution for 3 column grids with featured items that span 2x2 grids.
The idea is to wrap the item list with GridItem with a
feature
andshim
flags that determine how the views should behave.The method
getFeaturedIndex()
calculates which items in the original list should be featured. Then in thebuildGridItems()
we take 2 steps. First, flag all the items that are featured (and keep a list of these items). Afterwards, for each of these featured items, add 3 shims (+1, +3 and +4) relative to the featured item.In the
getView()
for featured items, we set the appropriate dimensions as 2x2 of the normal items. For shim items, set the visibility toGONE
.