如何实现有效的一个gridview布局 [英] How to implement efficiently a gridview layout

查看:627
本文介绍了如何实现有效的一个gridview布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个布局是3本书的每一行的架子上。

我目前想出GridView控件来显示书籍和手动添加了架子吧。当有超过9书籍出现的问题和滚动网格时布局被打破了。

任何人都可以给我建议另一种更好的方法来处理这​​个布局。谢谢

<类=h2_linDIV>解决方案,而不是

我想你应该设置在每个元素的背景(一个架子)的设置网格容器背景(三级货架)......

它看起来很难在你的情况,因为它会在一排三个图像..所以你需要尝试一些这个开关(位置%3)适配器的getView设置三个不同的图像

使用ListView,并且重新设置在数组列表中的数据,使每个元素都有三本书,你可以让所有的三张图片可点击该行,并可以使列表行无法点击和unfocusable

This layout is a shelf with 3 books each row.

I current come up with gridview for displaying the books and manually add up the shelf bar. The problem occurs when there are more than 9 books and the layout is broken when scrolling the grid.

Could anyone suggest me another better way to deal with this layout. Thanks

解决方案

I think you should set the background in each element (one shelf) instead of the setting the Grid container background (three shelf) ....

it's looking difficult in your case because it would has three images in a row ..So you need to try some this switch(position%3) in getView of adapter to set three different image

or

Use the ListView and Re-set the data in Array List so that each element has three books and you can make all three images clickable of that row and can make list row unclickable and unfocusable

这篇关于如何实现有效的一个gridview布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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