1 year ago

#372462

test-img

gpo

Android transparent AlertDialog in XML

Is it possible to make an AlertDialog transparent using only XML attributes in its layout or style, not in java / kotlin code?

I know I can make the AlertDialog transparent in code like this:

dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)

But I have some constraints and cannot use this or any other Java / Kotlin way.

I have tried various styling attributes in vain:

<style name="Theme.AlertDialog" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
    <item name="android:backgroundTint">@android:color/transparent</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:colorBackground">@android:color/transparent</item>
    <item name="android:colorBackgroundFloating">@android:color/transparent</item>
    <item name="android:panelColorBackground">@android:color/transparent</item>
    <item name="android:windowIsTranslucent">true</item>
</style>

Any idea?

android

android-alertdialog

0 Answers

Your Answer

Accepted video resources