How do I remove the black background from a dialog box in Android. The pic shows the problem.
Window window = d.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
this is my way, you can try!
<style name="NewDialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:background">@android:color/transparent</item>
</style>
use in java
Dialog dialog = new Dialog(this, R.style.NewDialog);
I hope help you !
Dialog pop up fill default black background color or theme color so you need to set TRANSPARENT
background into Dialog. Try below code:-
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setContentView(R.layout.splash);
dialog.show();
In my case solution works like this:
dialog_AssignTag.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
And Additionally in Xml of custom dialog:
android:alpha="0.8"
Try this in your code:
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
it will definately working...in my case...! my frend
For anyone using a custom dialog with a custom class you need to change the transparency in the class add this line in the onCreate():
getWindow().setBackgroundDrawableResource(android.R.color.transparent);