Z
Z
zoo2012-08-24 16:12:27
Android
zoo, 2012-08-24 16:12:27

How to make transparent background for Alert Dialog?

For a regular Dialog, it's quite simple

dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));

With alert, such a theme does not roll, also tried to apply styles when creating a Builder
builder = new AlertDialog.Builder(new ContextThemeWrapper(this,android.R.style.Theme_Translucent_NoTitleBar_Fullscreen ));

as well as custom themes
<style name="AlertDialogCustom" parent="@android:style/Theme.Dialog">
     <item name="android:windowBackground">@null</item> 
    <item name="android:windowFrame">@null</item>
   </style>

the effect is zero, can anyone come across?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim, 2012-08-24
@Bublik

Try not null but #00000000

0
0leGG, 2012-08-24
@0leGG

You can try using setContentView to set a view with a transparent background

Z
zoo, 2012-08-24
@zoo

I solved the problem with this sequence

        alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.show();
        alertDialog.setContentView(R.layout.custom_dialog); 

and without any dances with style \ backgraund, it will not immediately come to mind.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question