set Transparent background to alertdialog in android

define what follows in the styles.xml file

<style name="CustomDialog" parent="android:Theme.Dialog">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
</style>

and pass it as argument to the AlertDialog constructor

AlertDialog.Builder imageDialog = new AlertDialog.Builder(SubProducts.this, R.style.CustomDialog);

Or programmatically, through the Dialog instance you can call

myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT))

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)