Story By Ali Ahmad
author-avatar

Ali Ahmad

bc
aakak
Updated at Jun 12, 2022, 15:16
kwkak
like
bc
TextInputLayout
Updated at Dec 4, 2020, 00:27
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("Email Address"); textinput.setBoxBackgroundMode(textinput.BOX_BACKGROUND_OUTLINE); textinput.setErrorEnabled(true); textinput.setHintAnimationEnabled(true); textinput.setHelperText("Type your email 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);
like