我试图将图像显示为正在移动。所以我需要无缝地显示它们。 但是正如你在图像中看到的那样,还有一些空间。我怎么能解决它?
public class Ground {
private final Paint paint = new Paint();
private Bitmap bitmap;
private Bitmap bitmap1;
private Bitmap bitmap2;
final RectF rect;
public Ground(Bitmap bitmap, int left, int top) {
this.rect = new RectF(left, top, left + bitmap.getWidth(), top + bitmap.getHeight());
this.bitmap = bitmap;
this.bitmap1 = bitmap;
this.bitmap2 = bitmap;
}
public void draw(Canvas canvas) {
canvas.drawBitmap(bitmap, rect.left, rect.top, paint);
canvas.drawBitmap(bitmap1, rect.left+bitmap.getWidth(),rect.top,paint);
}
public void move() {
rect.offset(-10,0);
if(rect.left < -bitmap.getWidth()){
rect.offsetTo(0,0);
}
}
}
以下是Image