how to get position of bitmap inside canvas?
i have a canvas and an image inside canvas.i need know the position of the bitmap inside the canvas. in my case x and y are not static values.how to hide this image while touch on it? what is the advantage of using SurfaceView over View.Here i am usin开发者_如何转开发g view.
public void onDraw(Canvas canvas) {
Bitmap imgtable = BitmapFactory.decodeResource(getResources(),R.drawable.table_01);
int x=50;
int y=50;
canvas.drawBitmap(imgtable, x, y, null);
}
You need to hold on to the values x and y as long as you need to.
So for example of you could declared x and y at the class level change them when you need to and then get their value when you need to to.
精彩评论