Android: Change custom AlertDialog background

后端 未结 3 570
清酒与你
清酒与你 2021-01-07 00:13

dialog layout xml:




        
相关标签:
3条回答
  • 2021-01-07 01:01

    I had the same problem, I managed to fix it using a custom dialog like this:

    public class CustomDialog extends Dialog {
        public CustomDialog(Context context, View view) {
            super(context);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(view);
            getWindow().getDecorView().setBackgroundResource(android.R.color.transparent);
        }
    }
    
    0 讨论(0)
  • 2021-01-07 01:04

    Another option is to remove android:background="@android:color/white" from your layout. Then the alert dialog will have its default light grayish background uniformly. (Since you have forced an inverse on a dark theme) At least it would look nice and worth the hassle. Just my two cents.

    0 讨论(0)
  • 2021-01-07 01:14

    Hey setting your view to builder creates this gray lines on top-bottom,instead you can setView to your dialog.like dialog.setView(layout,0,0,0,0);It will bound your layout to whole dialog.

    0 讨论(0)
提交回复
热议问题