可点击区域的图像视图中? [英] Clickable area's within image view?

查看:124
本文介绍了可点击区域的图像视图中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想就这个形象可以点击各个区域。我已经切割图像到它的不同选择,然后把它与一个相对布局一起然后用于每个区域的onclick。这工作但是在图像周围的透明区域也算作可点击区域。这使得一些地区的硬/无法点击。

I'm trying to make each area on this image clickable. I have cutting the image into its different selections and then put it together with a relative layout then used a onclick for each area. This works however the transparent area around the images count as the clickable area too. This makes some area's hard/impossible to click on.

下面是图片: http://i77.photobucket.com/albums /j59/jombobmerly/footProb.png

有没有什么办法让onlclick忽略透明区域的或者这只是不去上班?

Is there any way to make the onlclick ignore the transparent area's or is this just not going to work?

推荐答案

//你可以使用onTouch听者

// you can use onTouch Listner

myimageView.setOnTouchListener(new OnTouchListener() {

    @Override
    public boolean onTouch(View v, MotionEvent event) {

   Log.e("HIGHT CLICk!!"+ event.getY(), "-----------"+event.getX());

    if((26<event.getX() && event.getX()<120) && (25<event.getY()&&event.getY()<120)){

//do your actions here
}

这篇关于可点击区域的图像视图中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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