1、先写个实体类,代表圆
- public class MyCircle {
- public float x;
- public float y;
- public int r=100;
- public int pointId;
- int red;
- int green;
- int blue;
- Random random=new Random();
- public MyCircle(float x, float y, int pointId) {
- this.x = x;
- this.y = y;
- this.pointId = pointId;
- red=random.nextInt(255);
- green=random.nextInt(255);
- blue=random.nextInt(255);
- }
- public void

本文介绍了一个Android应用示例,通过创建`MyCircle`类表示圆,并在`MyView`类中处理多点触摸事件,动态绘制不同颜色的圆。当手指按下时,实例化一个圆并在屏幕上显示;手指移动时更新圆的位置;手指抬起时移除对应的圆。实现了多指同时在屏幕上画圆的功能。
最低0.47元/天 解锁文章
558

被折叠的 条评论
为什么被折叠?



