edittext-mask icon indicating copy to clipboard operation
edittext-mask copied to clipboard

Is there way to set mask programmatically?

Open pavelpoley opened this issue 4 years ago • 1 comments

Is there way to set mask programmatically? (mask:mask="+7(###)###-##-##")

pavelpoley avatar Jun 26 '20 12:06 pavelpoley

Hi! You can apply the mask programmatically with this : inputEditText.setMask("##.###.###");

But the mask will not get applied until you set some text. Personally I fix that problem by calling setText("") right after setting the mask.

Also, if you want a hint to be applied on the mask you can use

inputEditText.setKeepHint(true);
inputEditText.setHint("00000");

bertween the call to setMask(...) and setText(...).

hrodrick avatar Sep 07 '20 12:09 hrodrick