Android展开式GridView,例如Google图片 [英] Android expandable GridView like Google images
问题描述
我想创建可扩展的GridView,其行为类似于Google图片页面.我想知道如何实现这样的功能:当我单击其中一张图像时,页面会展开并显示图片的详细信息.可以在Android中做类似的事情吗?
I would like to create expandable GridView which will behave similar to Google images page. I would like to know how can I achieve such functionality: when I click one of the images, page expands and shows details of the picture. Is it possible to do something similar in Android?
图片网格:
展开的图片网格:
推荐答案
我认为您未收到任何回复的原因是问题的措辞.当我第一次看到它时,我想到的是类似于可扩展列表视图的东西.参见此教程.
I think the reason you haven't received any responses is because of the wording of the question. When I first saw it I thought, something similar to expandable listview. See this tutorial.
但是无论如何,要实现所需的功能,您需要在GridView的OnClickListener中设置扩展" 函数.我建议您进行一个对话框活动,其中包含您需要的布局(带有文本/链接/等的图像),并在每个项目上单击,弹出对话框.它看起来与Google图片非常相似.
But anyway, to achieve what you want, you need to set the "expansion" function in the OnClickListener in your GridView. I would suggest have a dialog activity with the layout you need (image with text/links/etc) and on each item click, popup the dialog. It will look very similar to what Google images has.
这篇关于Android展开式GridView,例如Google图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!