用毕加索叠加图像

时间:2017-04-21 11:18:22

标签: android imageview picasso

我有一个主要产品图片,它始终显示在我的ImageView中。现在有可能有几个叠加(与原始图像大小相同,但有很多透明区域)。

所有这些图片都来自远程网址。 E.g:

Main image

Overlay

是否可以将所有这些加载到一个ImageView

2 个答案:

答案 0 :(得分:0)

您可以拥有自定义ImageViewload bitmaps with Picasso,然后在画布上绘制这些位图:

@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
}

答案 1 :(得分:-1)

你可以尝试这个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>
相关问题