How to remove border in custom AlertDialog?

后端 未结 3 1581
后悔当初
后悔当初 2020-12-21 15:34

I\'m trying to create custom AlertDialog with an image text and buttons. When I display it I get a white border which looks horrible.

相关标签:
3条回答
  • 2020-12-21 16:13

    This will remove borders:

    AlertDialog ad;
    ad= new AlertDialog.Builder(context).create();
    ad.show();
    ad.setContentView(R.layout.dialog_layout); // set your custom layout
    
    // Then initialize your dialog views like this
    TextView txt= (TextView) ad.findViewById(R.id.dialog_text); // a TextView inside dialog 
                                                                // layout
    txt.setText("I'm a custom dialog!");
    

    Also, I had a problem using a custom Dialog in full screen mode. my phone's notification bar kept showing up as long as the dialog wasn't dismissed. with a customized AlertDialog, this won't be an issue ;)

    0 讨论(0)
  • 2020-12-21 16:18

    If you want the Dialog Border to appear in any colour you wish you have to use layout style and a theme. There is an excellent article about it here: http://blog.androgames.net/10/custom-android-dialog/

    0 讨论(0)
  • 2020-12-21 16:19

    try this use Dialog Instead of AlertDialog.Builder

    .. for remove border line from Dialog..

    Dialog dialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar);
    
    0 讨论(0)
提交回复
热议问题