Android的数字密码字段 [英] Android numeric password field

查看:302
本文介绍了Android的数字密码字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个必须是一个数字密码字段一个EditText场。一切工作在纵向模式下确定;没有风景。当用户选择的EditText字段中,UI放大到外地和当我输入的所有字符都可见。

I have an EditText field which needs to be a numeric password field. Everything works OK in portrait mode; not in landscape. When the user selects the EditText field, the UI zooms into the field and when I type all the characters are visible.

我需要一个数字键盘也。我试着设置输入类型为文本密码|数量。 如果我删除数字选项一切工作的权利;否则就没有。

I need a numeric keyboard also. I tried setting the input type to text password|number. If I remove "number" option everything works right; otherwise no.

有什么建议?

推荐答案

这个问题可以不用去$ P $解决pcated 安卓密码。使用下面的code段,但不扭转的调用序列:

This problem can be solved without using deprecated android:password. Use the following code snippet, but do not reverse the sequence of calls:

    EditText editText = (EditText) findViewById(R.id.MyEditText);
    editText.setInputType(InputType.TYPE_CLASS_NUMBER);
    editText.setTransformationMethod(PasswordTransformationMethod.getInstance());

这篇关于Android的数字密码字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆