user2749218 user2749218 - 2 years ago 218
Android Question

How to remove transparent dark background outside of dialog box

I want to remove a transparent dark backgrond outside of dialog box.

enter image description here

I tried with:

final Dialog dialog = new Dialog(this);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(;
this.getWindow().setBackgroundDrawable(new ColorDrawable(;

Answer Source

Your question has already been answered here

Code from the link:

Add this to your styles.xml:

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

And then apply the theme to your activity:

<activity android:name=".SampleActivity" android:theme="@style/Theme.DoNotDim">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download