Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlay images with Picasso

I have one main product image, which always is displayed in my ImageView. Now it is possible that there are several overlays (which have the same size as the original image, but a lot of transparent areas).

All those images come from remote URLs. E.g.:

Main image

Overlay

Is it possible to load all of them into one ImageView?

like image 904
4ndro1d Avatar asked Dec 07 '25 02:12

4ndro1d


1 Answers

You can have your custom ImageView, load bitmaps with Picasso and then draw those bitmaps on canvas:

@Override
protected void onDraw(final Canvas canvas) {
    super.onDraw(canvas);

    canvas.drawBitmap(bitmap1, 0, 0, null); // lower image
    canvas.drawBitmap(bitmap2, 0, 0, null); // upper image
}
like image 126
azizbekian Avatar answered Dec 08 '25 15:12

azizbekian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!