Android 二维列表视图
我当前的应用程序需要创建一个巨大的细胞矩阵。假设最多 50 行和 50 列。每个单元格大约是屏幕的宽度。这会产生一个问题,因为构建该大小的单一视图是不可行的。这似乎非常适合拥有一个延迟显示单元格的列表视图,但它允许列和行而不仅仅是行。有谁知道是否存在这样的东西?
I have are requirement in my current application to create a giant matrix of cells. Say maybe a maximum of 50 rows and 50 columns. Each cell is about the width of the screen. This creates a problem because building a single view of that size is not feasible. This seems to lend itself well to having a listview that shows the cells lazily but one that allows columns and rows instead of just rows. Does anyone know if something like this exists?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
采用具有 2 列的 GridView 并为其定义自定义适配器。
只需检查此答案以获取更多信息:Android - 多列ListView
Take GridView with 2 columns and define custom adapter for the same.
Just check this Answer for more information: Android - Multi Columns ListView
最后我发现使用网格视图这似乎是不可能的。网格视图似乎根本没有设计为垂直和水平滚动。最后,我制作了一个完全自定义的控件,其工作方式类似,但允许水平和垂直滚动。
In the end I found out that this seems impossible using a grid view. It seems that grid views are not at all designed to scroll both vertically and horizontally. In the end I made a completely custom control that works in a similar way but allows both horizontal and vertical scrolling.
您应该查看 GridView,访问此链接获取官方文档和来自 Android 开发者官方博客的指南。
You should look at GridView, visit this link for official documentation and guidelines from android developers' official blog.