I'm trying to draw a bitmap on top right hand corner
Canvas
So far I have done the following:
//100x40 dimensions for the bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.backbutton); Rect source = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); Rect bitmapRect = new Rect(0, 0, canvasWidth -200,50); canvas.drawBitmap(bitmap, source, bitmapRect, paint);
The problem is that when the application starts, the bitmap does not appear on the screen. Full code:
public class MyView extends View { Rect bitmapRect; public MyView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public MyView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas);
Can someone help me here?
source share