3

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?

azizbekian
  • 60,783
  • 13
  • 169
  • 249
4ndro1d
  • 2,926
  • 7
  • 35
  • 65

2 Answers2

1

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
}
Community
  • 1
  • 1
azizbekian
  • 60,783
  • 13
  • 169
  • 249
-1

You can try this xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/image"
        android:layout_width="60dip"
        android:layout_height="60dip"
        android:adjustViewBounds="true"
        android:layout_centerInParent="true"
        android:scaleType="centerCrop" />

    <ImageView
        android:id="@+id/imagef"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerInParent="true"
        android:background="@drawable/ph_bg" />

</RelativeLayout>
Dilip
  • 2,622
  • 1
  • 20
  • 27