I want to create a material edittext field like this :
This is how I am creating the editext field:
TextInputLayout textInputLayout = new TextInputLayout(MainActivity.this);
textInputLayout.setHint("name:");
TextInputEditText editText = new TextInputEditText(MainActivity.this);
editText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
editText.setTypeface(Typeface.create("sans-serif-smallcaps", Typeface.NORMAL));
editText.setScaleX(0.99f);
textInputLayout.addView(editText);
textInputLayout.setBoxBackgroundMode(TextInputLayout.BOX_BACKGROUND_OUTLINE);
textInputLayout.setBoxCornerRadii(10, 10, 10, 10);
textInputLayout.setPadding(10, 10, 10, 10);
textInputLayout.setBoxStrokeWidth(2);
layout.addView(textInputLayout);
This is my output: enter image description here
As you can see, the edittext field I get doesn't have any borders. How do I fix this?
I have tried textInputLayout.setBoxBackgroundMode(TextInputLayout.BOX_BACKGROUND_FILLED);
, but the result is still the same.