Expand an image in gridview when clicked in Android

可紊 提交于 2019-12-13 07:43:19

问题


I am implementing a GridView which contains images.
I want to expand an image to occupy the whole row when it's clicked as shown in the images below.
I also want to show a button when the image is expanded so the user can take an action similar to how the ESPN app does that.

How can I achieve this?

---->


回答1:


Surround your layout with a relative layout. Create a layout and a button inside it outside grid layout/inside relative layout. Set it's initial visibility to gone and match it's height, width to row you want it to encompass. Then in the onclick of the image set the layouts view to visible and it's button. Perhaps not perfect but it has the added benefit of allowing scrolling of your gridview while showing the big image you want.



来源:https://stackoverflow.com/questions/29957414/expand-an-image-in-gridview-when-clicked-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!