我们如何设置输入类型,一个EditText编程?我想:
How do we set the input type for an EditText programatically? I'm trying:
mEdit.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
它似乎并没有产生任何影响。
it doesn't seem to have any effect.
感谢
按照 TextView的文档,该方案版本的Android:密码是setTransformationMethod(),不setInputType()。所以是这样的:
According to the TextView docs, the programmatic version of android:password is setTransformationMethod(), not setInputType(). So something like:
mEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
应该做的伎俩。
should do the trick.