I am trying to make a semi-transparent Dialog so that you can see the game in the background before it starts.
I've looked at this article on how to make it transparent, but there's nothing really on semi-transparent or if it's possible.
android dialog transparent
What I want is kind of like the picture he provides, but what the solution gives is the background of the dialog being completely gone.
Thanks a lot!
You can keep using the code provided at android dialog transparent.
Create at colors.xml the background color that you want, for example:
<color name="translucent_black">#80000000</color>
and set the dialog to have the translucent_black with:
mDialog.getWindow().setBackgroundDrawableResource(R.color.translucent_black);
Note: the alpha channel is represented by the first two digits passed on the color resource. In the example I'm setting the alpha to be "80". You can read more about android colors at Android Color.
Set the background color to #AARRGGBB where AA is the alpha channel. For example you could use #00000000 for the color or the short method: #ARGB so that would be #0000 Using the shorthand notation the values are each just used twice where #264C would be the same as #226644CC See also Android Color for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With