有谁知道如何循环这幅画布?我想稍后添加一个 onTouch 方法并获取 X 位置。谢谢你。
@Override
protected void onDraw(Canvas canvas) {
//Canvas canvas= new Canvas();
xp1 = canvas.getWidth()/2;
Log.d("test1", "It went pass onDraw");
xp2 = canvas.getWidth()/2;
yp1 = 25;
yp2 = 760;
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(paddle1, xp1,yp1, null);
canvas.drawBitmap(paddle2,xp2,yp2, null);
Paint white = new Paint();
white.setColor(Color.WHITE);
canvas.drawText("Score P1:"+ p1Score +" P2: " + p2Score , 700, 20,white );
Log.d("test1", "It's done with onDraw");
}