I Have drawn a set of images(balls) on a SurfaceView. Now am trying to make the image(ball) i touch to disappear. Am having those images in a collection. Am not understanding how to generate touch event on individual image. Can any one provide some help on this?
Thank You Yashwanth.B
假设您有一个ImageView
,则应该实现onTouchEvent(MotionEvent event)
方法。
You could use the Android utility " sendevent " to generate a touch event and should be able be found it at /system/bin/, if you know the coordinate of your image.
You also need to know the device node of your touch panel, assuming it is event1
/system/bin/sendevent /dev/input/event1 1 330 1
/system/bin/sendevent /dev/input/event1 3 0 x
/system/bin/sendevent /dev/input/event1 3 1 y
/system/bin/sendevent /dev/input/event1 0 0 0
/system/bin/sendevent /dev/input/event1 1 330 0
Here x , y represent your coordinate of your image.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.