Programmatically create a MaterialButton with Outline style

If you want to apply a Outlined button you can use the R.attr.materialButtonOutlinedStyle attribute style in the constructor:

MaterialButton outlinedButton = new MaterialButton(context,null, R.attr.materialButtonOutlinedStyle);
outlinedButton.setText("....");

enter image description here


You can use below:

MaterialButton testSignIn = new MaterialButton(context, null, R.attr.borderlessButtonStyle);
String buttonText = "Sign-in & empty test account";
testSignIn.setText(buttonText);