如何通过交互将绘图中的图像绘制到画布上

时间:2022-06-14 21:19:26

I have created a canvas on android which has a circle drawn on and buttons however I want an image from the drawables to be dropped in via some sort of interaction so I thought of using a button, but I have created this screen only using the content view of the java class, thus I cannot use xml so is there any way you guys would know how I can grab the image on click in java (programatically).

我已经在android上创建了一个画布,其上有一个圆圈和按钮,但是我希望通过某种交互方式将drawable中的图像放入,所以我想使用一个按钮,但我只使用内容创建了这个屏幕java类的视图,因此我不能使用xml所以你们有什么方法可以知道如何在java上点击图像(编程)。

Thanks.

1 个解决方案

#1


0  

you can draw anything on canvas,and add events to custom class that you have designed...

你可以在画布上绘制任何东西,并将事件添加到你设计的自定义类中......

take a look http://android-er.blogspot.in/2010/05/draw-bitmap-on-view.html

看看http://android-er.blogspot.in/2010/05/draw-bitmap-on-view.html

#1


0  

you can draw anything on canvas,and add events to custom class that you have designed...

你可以在画布上绘制任何东西,并将事件添加到你设计的自定义类中......

take a look http://android-er.blogspot.in/2010/05/draw-bitmap-on-view.html

看看http://android-er.blogspot.in/2010/05/draw-bitmap-on-view.html