Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image over other image Android

How can i set image (semi-trasparent) over other image ?
I need to create new bitmap and then save it.

Thanks all.

like image 558
enfix Avatar asked Dec 27 '22 18:12

enfix


1 Answers

    Bitmap bitmap1 = null; // define it
    Bitmap bitmap2 = null; // define it

    Bitmap resultBitmap = Bitmap.createBitmap(bitmap1.getWidth(), bitmap1.getHeight(), Bitmap.Config.ARGB_8888);

    Canvas c = new Canvas(resultBitmap);

    c.drawBitmap(bitmap1, 0, 0, null);

    Paint p = new Paint();
    p.setAlpha(127);

    c.drawBitmap(bitmap2, 0, 0, p);

    // Your final bitmap is resultBitmap
like image 98
Ali Alnoaimi Avatar answered Jan 09 '23 18:01

Ali Alnoaimi