Search code examples
androidandroid-alertdialogandroid-dialogfragment

Translucent activity & DialogFragment = Background around still shown


I have a FragmentActivity that makes at the beginning a fragment transacation loading a DialogFragment which builds an AlertDialog. The theme of the Activity is set to @android:style/Theme.Translucent.NoTitleBar. I tried all and I am not being able to show the DialogFragment without the background around.

Please do not care about the red ones, I only obfuscated my app. The green color is the problem is the backgound that I want to get rid of, if I set the color to Transparent, it is still shown in white.

enter image description here


Solution

  • When you create the DialogFragment and call it with show() you will get the background around, not matter if you set the background color to transparent. If you do a fragment transaction to show the DialogFragment, then you can change the color of the background around, and set it to Transparent.