Draw Bitmap with Alpha opacity ratio Android

Bitmap bgr = BitmapFactory.decodeResource(getResources(),R.drawable.background);       
Paint transparentpaint = new Paint();
transparentpaint.setAlpha(100); // 0 - 255
canvas.drawBitmap(bgr, 0, 0, transparentpaint);

public void setAlpha (int a)
Since: API Level 1
Helper to setColor(), that only assigns the color’s alpha value, leaving its r,g,b values unchanged. Results are undefined if the alpha value is outside of the range [0..255]

This entry was posted in Android Examples Code, Bitmap, drawing and tagged , . Bookmark the permalink.

Comments are closed.