Image overlay on Picasso
I have one main product image that is always displayed in mine ImageView
. It is now possible that there are multiple overlays (which are the same size as the original image, but many transparent areas).
All of these images come from remote URLs. For example:.
Can I load all of them into one ImageView
?
+3
source to share
2 answers
You can have your custom ImageView
, download bitmaps from Picasso , and then draw these bitmaps onto the 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
}
0
source to share
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>
-1
source to share