Android – how to programmatically create an integer password EditText

I need to programmatically create an EditText field. But it must be the inputtype of int and it must be a password field. How can I achieve this? I tried these, but I didn't work

> editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD); > editText.setKeyListener(DigitsKeyListener.getInstance(“0123456789”)); > editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);

resolvent:

Try:

editText.setInputType(InputType.TYPE_CLASS_NUMBER);
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>