简体   繁体   English

android canvas 画圆并获取触摸事件

[英]android canvas draw circles and get touch events

i have been trying to make such a demo where i need to draw many(hundreds of) circle shapes on canvas (or any other way if possible),我一直在尝试制作这样一个演示,我需要在canvas (或任何其他可能的方式)上绘制许多(数百个)圆形

after drawing the canvas i need to zoom and move it ..绘制 canvas 后,我需要缩放和移动它..

and also want to capture the click(touch) event of each shape separately ..并且还想分别捕获每个形状的点击(触摸)事件..

so i know i can get canvas touch event and get x and y positions and check which which circle is touched but i have to draw many circles and as well after zooming and moving the circle's x and y pos is changes so plz help me..所以我知道我可以获取 canvas 触摸事件并获取 x 和 y 位置并检查哪个圆圈被触摸但我必须绘制许多圆圈以及在缩放和移动圆圈的 x 和 y 位置后发生变化所以请帮助我..

Give me any suggestion how to do this..the way to go.. or if any ANDROID MASTER have done some thing like this..plz plz give me code sample ..给我任何建议如何做到这一点..通往 go 的方式.. 或者如果有任何 ANDROID MASTER 做过这样的事情..请给我代码示例..

thank you all, good day..谢谢大家,美好的一天。。

according your requirement you have 2 use one of the android game framework you can find so many game engine check this thread or you can use andengine one of the best 2D game engine in that you can find many example code.根据您的要求,您有 2 个使用 android 游戏框架之一,您可以找到很多游戏引擎检查此线程,或者您可以使用最好的 2D 游戏引擎之一,因为您可以找到许多示例代码。

for your requirement just follow the PinchZoomExample from here根据您的要求,只需从此处遵循 PinchZoomExample

any further help comment the question i love to help this prob.任何进一步的帮助评论我喜欢帮助这个问题的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM