具有行跨度和列跨度的自定义网格视图 [英] Custom Grid View with Row span and Column span

查看:21
本文介绍了具有行跨度和列跨度的自定义网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一个具有如下图形视图的网格视图.我浏览了各种博客和 S.O 问题,不幸的是我无法为一个特定的网格项目提供行和列跨度,并且网格视图也不支持此功能.而且我不想创建带有其他视图的动态滚动视图,因为有很多数据并且会导致性能问题.所以如果有人有任何建议.请回复 .提前致谢.

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.

推荐答案

您是否打算为可滚动视图重复该模式?更清楚的是,您的跨度大的 Grid 项目是否定期重复?

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?

一种选择是使用列表视图并使用两个普通视图实现大跨度视图作为列表视图的一行,并带有诸如special_row"之类的标签,并将常规视图实现为带有诸如普通行"之类的标签的另一行".根据需求,您可以通过访问行标记来回收行.

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.

我找到了一个库,它为 android 实现了类似 UI 的 pinterest.这里面有一个对称的观点.结帐 PinterestLisView.

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

这里是另一种有趣的技术,它为网格项目指定了 coulmn span 和 row spans.我取自这个问题.我想您可以通过以编程方式指定列和行跨度来取消网格项的静态 xml 声明.

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.

这篇关于具有行跨度和列跨度的自定义网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆