Want to do
I want to change the default background color of AlertDialog from translucent to transparent.
I don't want to change the color of white place.
What I tried
Added style to AlertDialog.Builder. However, this code changed the background not only translucent but also white place.
styles.xml
<style name="TransparentDialogTheme" parent="@android:style/Theme.Light">
<item name="android:windowNoTitle">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
MainActivity.cs
var layout = LayoutInflater.Inflate(Resource.Layout.dialog_eventLogOptionMenu, null);
var dlg = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.TransparentDialogTheme).Create();
1条答案
按热度按时间btqmn9zl1#
您可以尝试将此代码
<item name="android:backgroundDimEnabled">false</item>
添加到您的style
中。它可以去除alertdialog背景中的黑色。