Home > Net >  Setting corner radius on alertDialog using Builder. Android
Setting corner radius on alertDialog using Builder. Android

Time:12-03

I need to set rounded corners on an AlertDialog but specifically using a Builder.

Is it possible to set my own layout?

when using builder.setview(R.layout.my_style) i get a crash.

CodePudding user response:

you have added Style in layout so its crashed. It should be

AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.my_style);
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.xml_ui_file, null);//Add your XML File name
dialogBuilder.setView(dialogView);
  AlertDialog alertDialog = builder.create();
alertDialog.show();
  • Related