私のプログラムでは、画像は垂直にアニメーション化されています。私はアニメーションを右マージンで停止したいと思います。私は、2番目のif-sequenceのcondtionはそれを言うべきだと思いますが、invalidate()メソッドがその時点でアニメートするのを止めるにはどうすればいいですか?アンドロイド - 停止アニメーション
private Runnable r = new Runnable() {
@Override
public void run() {
invalidate();
}
};
protected void onDraw(Canvas c) {
BitmapDrawable ball = (BitmapDrawable) mContext.getResources().getDrawable(R.drawable.ball);
if (x<0) {
x = this.getWidth()/2;
y = this.getHeight()/3;
}
else {
x += xVelocity;
if ((x > this.getWidth() - ball.getBitmap().getWidth()) || (x < 0)) {
}
}
c.drawBitmap(ball.getBitmap(), x, y, null);
h.postDelayed(r, FRAME_RATE);
}
}
あなたの質問は不明です。 –
どのようにして不明ですか? –