TextInputLayout
setTitle("TextInputLayout");
textinputlayout1.removeView(edittext1);
final com.google.android.material.textfield.TextInputLayout textinput = new com.google.android.material.textfield.TextInputLayout (this);
textinput.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
//textinput.setBoxBackgroundColor(0xFFFFFFFF);
textinput.setBoxStrokeColor(0xFF0D47A1);
textinput.setBoxCornerRadii(5, 5, 5, 5);
textinput.setPadding((int)8, (int)0 , (int)0 , (int)0 );
textinput.setHintEnabled(true);
textinput.setHint("E Address");
textinput.setBoxBackgroundMode(textinput.BOX_BACKGROUND_OUTLINE);
textinput.setErrorEnabled(true);
textinput.setHintAnimationEnabled(true);
textinput.setHelperText("Type your e address");
textinput.setCounterEnabled(true);
textinput.setCounterMaxLength(15);
if (edittext1.getText().toString().length() > textinput.getCounterMaxLength()) {
textinput.setError("Reached the text max length");
} else {
textinput.setErrorEnabled(false);
}
textinput.addView(edittext1);
textinputlayout1.addView(textinput);
textinputlayout2.removeView(edittext2);
final com.google.android.material.textfield.TextInputLayout textinput2 = new com.google.android.material.textfield.TextInputLayout (this);
textinput2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
//textinput2.setBoxBackgroundColor(0xFFFFFFFF);
textinput2.setBoxStrokeColor(0xFF0D47A1);
textinput2.setBoxCornerRadii(5, 5, 5, 5);
textinput2.setPadding((int)8, (int)0 , (int)0 , (int)0 );
textinput2.setHintEnabled(true);
textinput2.setHint("Password");
textinput2.setBoxBackgroundMode(textinput.BOX_BACKGROUND_OUTLINE);
textinput2.setErrorEnabled(true);
textinput2.setHintAnimationEnabled(true);
textinput2.setHelperText("Type your password");
textinput2.setCounterEnabled(true);
textinput2.setCounterMaxLength(15);
textinput2.setPasswordVisibilityToggleEnabled(true);
textinput2.setPasswordVisibilityToggleDrawable(R.drawable.ic_lock);
if (edittext2.getText().toString().length() > textinput2.getCounterMaxLength()) {
textinput2.setError("Reached the text max length");
} else {
textinput2.setErrorEnabled(false);
}
textinput2.addView(edittext2);
textinputlayout2.addView(textinput2);
Unfold
setTitle("TextInputLayout");
textinputlayout1.removeView(edittext1);
final com.google.android.material.textfield.TextInputLayout textinput = new com.google.android.material.textfield.TextInputLayout (this);
textinput.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams……
Dear Reader, we use the permissions associated with cookies to keep our website running smoothly and to provide you with personalized content that better meets your needs and ensure the best reading experience. At any time, you can change your permissions for the cookie settings below.
If you would like to learn more about our Cookie, you can click on Privacy Policy.
Waiting for the first comment……