How To Draw A Bitmap On The Top Right Of The Canvas
I am trying to draw a bitmap on top right hand corner of the Canvas So far I have done the following: //100x40 dimensions for the bitmap bitmap = BitmapFactory.decodeResource(getRe
Solution 1:
in MyView right under Rect bitmapRect; make the variables
publicint width;
publicint height;
then in your MyView class put this method in there
@OverrideprotectedvoidonSizeChanged(int w, int h, int oldw, int oldh)
{
width = w;
height = h;
}
now you have the width and height of the canvas that you are using then in your onDraw() method make the bitmapRect like this
bitmapRect = new Rect(width -200,0, width, 50);
i think the problem is that how you had it you had a negative number in your rect and it was inverting the bitmap, when you use a draw command with Rects, one is the source of what your going to draw and one is the destination of where its going to be drawn
Post a Comment for "How To Draw A Bitmap On The Top Right Of The Canvas"