だから私は「描画可能なビュー」と呼ばれるビューを作成しました
class DrawableView extends View{
Context mContext;
int touches=0,k,Xoffs,clicks=0;
double x_1 = 0,x_2=0;
private float mLastTouchX, mLastTouchY;
public DrawableView(Context context) {
super(context);
mContext = context;
}
....
@Override
protected void onDraw(Canvas canvas){
Paint myPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
canvas.drawColor(Color.BLUE);
myPaint.setColor(Color.WHITE);
canvas.drawCircle(200, 100, 20, myPaint);
}
..... more code....
}
ondraw コマンド内でのみ無効にできます。つまり、「invalidate();」を呼び出す ondraw コマンドの最後でループします。
g_draw.invalidate(); を何度も呼び出そうとしました。または g_draw.postInvalidate(); (g_draw は、作成された Drawable View の名前です) 他のクラスやメインのアクティビティ クラスからでも動作しません。なぜ、どうすれば修正できますか?
ありがとう