如何制作一个水平和垂直滚动的二维图库?
我是 Android 新手,我想制作一个图像库,其中每一列都是一个类别,用户可以垂直和水平滚动。
我发现了一篇关于如何显示图像列表的有用帖子 在这里。我想知道是否可以在图库视图中嵌套图像列表?
I'm new to Android and I want to make an image gallery where each column is a category, and users can scroll both vertically and horizontally.
I found a useful post about how to display list of images here. I'm wondering if it's possible to nest lists of image inside of a gallery view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将图库放入 GridView 中,其中一列和列大小设置为填充父视图(或达到此效果的其他内容)。将画廊放入 GridView 中,并在 LayoutParams 中将其高度设置为您想要占用的可绘制对象/视图的高度。您需要做的就是当移动一个画廊时,即可移动网格视图中的所有其他画廊。我将在下面发布代码。注意:我所做的代码是对有效概念的测试,我只是在手机上尝试过。然而,它并不浮华。当我继续研究它时,我可能会更新代码以使其看起来更好。
~Aedon :)
和我的 xml 文件:
Place a gallery into a GridView with one column and column size set to fill the parent view (or something to that effect). Place a gallery into the GridView and set its height in LayoutParams to the height of the drawables/views you want to occupy them. All you need to do then is when one gallery is moved to move all the others in the grid view. I'll post the code below. Note: the code I did is a test of concept that works, I just tried it on my phone. As such however, it is not flashy. As I continue to work on It I may update the code to make it look nicer.
~Aedon :)
and my xml file:
您可能需要一个 GridView。
You may need a GridView.