Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there way to set mask programmatically? #58

Open
pavelpoley opened this issue Jun 26, 2020 · 1 comment
Open

Is there way to set mask programmatically? #58

pavelpoley opened this issue Jun 26, 2020 · 1 comment

Comments

@pavelpoley
Copy link

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

@hrodrick
Copy link

hrodrick commented Sep 7, 2020

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(...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants