如何使图像映射或热点上的android [英] How to make an image map or hotspots on android

查看:267
本文介绍了如何使图像映射或热点上的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林做在Android上的应用程序,需要做一个图像地图或热点的图像上,这样如果你点击某个点它做一些事情的形象。

Im making an app on android and need to make an image map or hotspots on an image so that if you click on a certain point of the image it does something.

上面的图片是什么,我需要它。我需要它,这样如果你点击Facebook的,它做一件事情,如果你点击别人它另一回事。

The image above is what i need it for. I need it so that if you click on facebook, it does one thing, and if you click on the others it does another.

是的,我曾试图让他们的按钮,但是,这是不是我需要的,我只是想了解如何使图像映射。

And yes I have tried making them buttons but, that is not what I need, I am just trying to learn how to make an image map.

推荐答案

如果您知道的区域在图像中的位置,它应该是pretty的方便。使用单个ImageView的。设置onTouch监听器,并查找DOWN事件。记录的位置。然后在UP事件检查原来的位置。如果事件位置是图像的边界内,他们只是点击它

If you know the location of the areas in the image, it should be pretty easy. Use a single ImageView. Set an onTouch listener, and look for DOWN events. Record the location. Then on the UP event check that original location. If the event location is within the bounds of an image, they just clicked it.

您也可以做到这一切在下降,这取决于你是否希望交换机发生时,他们第一次接触它或者当他们消除他们的手指(如点击一样)。

You can also do all of it in down, depending on whether you want the switch to happen when they first touch it or when they remove their finger (like clicks do).

这篇关于如何使图像映射或热点上的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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