protected void onDraw(Canvas canvas)
{
if (x == getWidth() - bmp.getWidth())
{
xSpeed = -1;
}
if (x == 0)
{
xSpeed = 1;
}
x = x + xSpeed;
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(bmp, x , 10, null);
}
比方说,它是如何工作的x = 0
,xSpeed = 1
请
向我解释一下。