I have an EditText
wrapped in a TextInputLayout
. The TextInputLayout
has an option for maximum length. Example below:
app:counterMaxLength="12"
Is it possible to have an option for counterMinLength? For example, if I am entering a password where the length cannot be less than a certain length.
I dont think that they are supporting this option at the moment :)
But I think if you want you can easily create a custom Edittext and then validate the minimum number of input field by using
edittext.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (edt.getText().toString().trim().length() < 8) {
edt.setError("Minimum length exception");
}
}
or you can you addTextChangedListener
for your edittext
Something like that. ^^