Android Custom Alert Dialog Display Error after changing the Build Version Android Custom Alert Dialog Display Error after changing the Build Version android android

Android Custom Alert Dialog Display Error after changing the Build Version


It resolved my problem by changing the following code in Custom Dialog Theme xml file.

<?xml version="1.0" encoding="utf-8"?><resources>    <style name="CustomDialogTheme" parent="@android:style/Theme.Translucent.NoTitleBar">        <item name="android:windowFrame">@null</item>        <item name="android:windowContentOverlay">@null</item>        <item name="android:backgroundDimEnabled">true</item>        <item name="android:windowIsTranslucent">true</item>        <item name="android:windowNoTitle">true</item>    </style></resources>


I also faced the same problem. the problem is when I called constructor of Dialog class

Dialog(Context context, int themeId)

it will hide the background activity. The only solution that i found is don't call this constructor, instead only call

Dialog(Context context)

and set your style in the layout file.

So in your code, only write

super(context)

instead of

super(context, themeid);


Apparently, this is a known issue.

This only happens when you try inheriting from the framework themes. Using @android:style directly will still treat them as non- fullscreen, which punches through the black background as expected.

One workaround is to start with a nearly-blank theme (like Panel or Translucent) and then render what you need in your own layout (such as dialog edges, etc).

Thought, I still don't fully understand this solution myself yet.

And actually, I'm no longer sure they're talking about the exact same bug you've seen, since they're talking about it not working for an older version of the sdk (not a newer one like yours). See the bug report.