Draw Multiple Bitmaps On Imageview
I have an imageview which displays an first image. I want to draw second smaller image on top of it. I am using canvas to draw the second image but it doesn't appears. Here I want
Solution 1:
Edit:
Canvasc=newCanvas(myBitmap);
c.drawBitmap(bm, 0, 0, null);
if(countClicked == 2) { //Do this before .setImageBitmap
c.drawBitmap(secondBitmap, x, y, p)
}
iv2.setImageBitmap(myBitmap); //This needs to go after you add the second imageIt was drawing, but it was drawing after you set the image to the view, so it never shows up.
Solution 2:
This is how I overlay 2 images together
// Get your images from their filesfinalBitmapiconL=
BitmapFactory.decodeResource(ctx.getResources(),
getResourceID("alm_big", "drawable", ctx));
finalBitmapbmpCombo=
iconL.copy(Bitmap.Config.ARGB_8888, true);
finalBitmapbmpTop=
BitmapFactory.decodeResource(ctx.getResources(),
getResourceID(strIcon_Big, "drawable", ctx));
// Use the canvas to combine them.// Start with the first in the constructor.finalCanvascnv=newCanvas(bmpCombo);
// Then draw the second on top of that
cnv.drawBitmap(bmpTop, 0f, 0f, null);
// bmpCombo is now a composite of the two.
bld.setLargeIcon(bmpCombo);
Post a Comment for "Draw Multiple Bitmaps On Imageview"