How to remove transparent dark background outside of dialog box

In addition to chuky's answer;

If your minSdkVersion value is greater than or equal to 14, you can use setDimAmount() method.

dialog.getWindow().setDimAmount(float amount);

According to reference;

amount The new dim amount, from 0 for no dim to 1 for full dim.

or

As stated previously, you can clear window flag.


Your question has already been answered here

Code from the link:

Add this to your styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.DoNotDim" parent="android:Theme">
    <item name="android:backgroundDimEnabled">false</item>
  </style>
</resources>

And then apply the theme to your activity:

<activity android:name=".SampleActivity" android:theme="@style/Theme.DoNotDim">

Hope this will help you...

dialog.getWindow().getDecorView().setBackgroundResource(android.R.color.transparent);
dialog.getWindow().setDimAmount(0.0f);
dialog.show();