我怎样才能让图片来自触摸网格视图中消失? [英] How can I make images disappear from a grid view on touch?

查看:208
本文介绍了我怎样才能让图片来自触摸网格视图中消失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在它的各种图像视图网格视图,我想触摸时这些图像消失。

I have a grid view with various image views within it, and I want these images to disappear when touched.

我怎样才能做到这一点?我怎样才能实现触摸侦听这些网格视图图像?

How can I do this? How can I implement a touch listener for these grid view images?

推荐答案

的ImageViews都是类型的视图和布局ViewGroups。所有这些你可以设置能见度消失或删除。所以,真正你只是neeed实施onTouchListener在ImageViews事件处理程序,然后设置知名度。所以,你可能要考虑设置一个整体布局,以无形的,以及如果你想隐藏的一次。你可以做

The ImageViews all are types of views and the layouts are ViewGroups. Any of these you can set the visibility to gone or removed. So really you just neeed to implement onTouchListener event handler and then set visibility on the ImageViews. So you might want to consider setting a whole layout to invisible as well if you want to hide them all at once. You can do

LinearLayout myLinearLayout = (LinearLayout)findViewById(myLinearLayoutId);
myLinearLayout.setVisibility(View.GONE) // or to show again View.VISIBLE

一般

       view.setVisibility(View.GONE) or View.INVISIBLE

有关onTouchListener教程参见:<一href=\"http://www.mybringback.com/tutorial-series/3279/android-the-basics-32-androids-ontouchlistener-and-motionevent/\" rel=\"nofollow\">http://www.mybringback.com/tutorial-series/3279/android-the-basics-32-androids-ontouchlistener-and-motionevent/

For tutorial on onTouchListener see: http://www.mybringback.com/tutorial-series/3279/android-the-basics-32-androids-ontouchlistener-and-motionevent/

这篇关于我怎样才能让图片来自触摸网格视图中消失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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