Universal max length for EditText - Android

56 Views Asked by At

I know about the similar max length method for EditText that looks like this

editText.maxLength = "21"

But the problem is that this type of method isn't effective in my case. I have an EditText that has special dimension, so my goal is to not allow symbols to pass edittext's border. I nedd something that maximizes length of edittext more by dimension, than by symbols. Symbols have a different size, so maybe maxLength should be based on size of "M" symbol.

Works perfectly fine:

enter image description here

But when symbols bigger appear this happens:

enter image description here

0

There are 0 best solutions below