Android Question Set semi transparency of a panel outside its contained image

Matteo Granatiero

Active Member
Licensed User
For the semi-transparency of the panel use:
Dim cd As ColorDrawable
    cd.Initialize ( Colors.ARGB( 100, 0, 0, 0) , 5dip )
    Panel1.Background = cd

The problem is: if I load an image in the panel (which is smaller than the panel panel because I set Gravity.Center, how do I set the rest of the panel with semi-transparency without "coloring" the inside of the image?
I attach image to make the idea


  • b4.png
    14.4 KB · Views: 373

Semen Matusovskiy

Well-Known Member
Licensed User
Final variant. Tested under API 24 only, but should work for any Android 4+.
Let me know, if you will find troubles.


    11.9 KB · Views: 172
Upvote 0