0
화면에 Touch 이벤트가있는 원을 그리는 앱을 만들고 있습니다. 다음 코드는 잘 작동 :캔버스와 이벤트 TOCH로 이미지에 원 그리기
Class Punto extends view{
Paint paint;
Point point = new Point();
Public Punto(Context contex){
super(context);
}
@Override
protected void onDraw(Canvas canvas){
super.onDraw(canvas);
paint.setColor(Color.BLUE);
canvas.drawCircle(point.x,point.y,10,paint);
}
@Override
public boolean onTouchEvent (MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN :
point.x = event.getX();
point.y = event.getY();
break;
}
return true;
}
class Point{
float x,y;
}
활동 :
public class Pintar extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Punto punto = new Punto(this);
setContentView(punto);
}
그러나 나는 원이 그림에 그려진 것이 필요 (내 경우는 시장의 비행기입니다에)하지만 난 방법을 모르는 할 수 있어요.
모습을. 획 및 채우기에 대한 옵션이 있어야합니다 (또는 원하는 경우에만 채우기). – Chris