Android make bitmap opaque against background color

Given a bitmap, I know how to make an ImageView more transparent by setting alpha. But I want to also set a white background color (different from the view its sitting on), so it appears more opaque than transparent.

Referring to the image below,

I get the left pic using , ImageView.SetBitmapImage(bitmap).
Using ImageView.SetAlpha = 0.5, I get the middle pic
but how do I get the right pic.

enter image description here

Also, in my axml, I have set the ImageView background color to white, but it still doesn't help...I still get the middle pic.

        android:background="#FFFFFF" />

1 answer

  • answered 2018-03-13 22:02 password

    I solved this by wrapping the ImageView in a LinearLayout, where the backgroundcolor was set to white. Then the bitmap alpha was fine