簡體   English   中英

兩個圖像作為ImageButton中的背景?

[英]Two Images as background in ImageButton?

我正在使用一個ImageButton,它將一個圖像作為背景,我將在運行時通過代碼動態獲取它。現在,我想將播放圖像設置在前一個圖像上方,以便兩者都可見。任何幫助將不勝感激。

嘗試將圖像添加為背景,並在其上方添加想要作為源的圖像。

您將需要合並圖像:

public static Bitmap mergeBitmaps(Bitmap original, Bitmap overlay) {
    Bitmap result = Bitmap.createBitmap(original.getWidth(), original
        .getHeight(), Config.ARGB_8888);
    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setAntiAlias(true);

    canvas.drawBitmap(original, 0, 0, paint);
    canvas.drawBitmap(overlay, 0, 0, paint);

return result;

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM