-1
나는 캔버스를 가지고 있는데 캔버스에 squre가있다.image onDraw 메서드는 x 축의 pixes를 앞으로 나아가게 할 때 runnable에서 움직이지 않는다.
이 스퀘어 x 축에서 이미지를 이동하고 싶지만 어떻게 바뀌 었는지 안정적입니다.
public void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
// Bitmap myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.googlelogo320x480);
// canvas.drawBitmap(myBitmap, 0, 0, null);
myPaint = new Paint();
myPaint.setColor(Color.GREEN);
myPaint.setStyle(Paint.Style.STROKE);
myPaint.setStrokeWidth(3);
canvas1 = canvas;
canvas1.drawRect(80, 40, 570, 800, myPaint);
myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.horse);
canvas1.drawBitmap(myBitmap, i, 10, myPaint);
handler = new Handler();
runnable = new Runnable() {
@Override
public void run() {
canvas1.drawBitmap(myBitmap, i, 10, myPaint);
System.out.println(i);
if(i<550){
handler.postDelayed(this, 100);
i++;
}
}
};
handler.postDelayed(runnable, 1000);
}
}
내가 미리 .... 캔버스에
덕분에 이미지를 이동해야 할 일.