How to remove transparent dark background outside of dialog box

android, android-dialog

Solution

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">

Problem

I want to remove a transparent dark backgrond outside of dialog box. I tried with: ``` final Dialog dialog = new Dialog(this); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE)); this.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE)); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.spinner_layout); getWindow().getDecorView().setBackgroundResource(android.R.color.transparent); ```

Original source

Related problems