为电话号码输入设置密码的Edittext?(机器人)

Por*_*jim 26 android android-edittext

如何使用手机输入和隐藏字符串的功能获取Edittext.我知道

android:inputType="textPassword"
Run Code Online (Sandbox Code Playgroud)

隐藏字符串,而

android:inputType="phone"
Run Code Online (Sandbox Code Playgroud)

打开拨号盘界面.

如何将两者结合起来?

Die*_*ano 34

android:password不推荐使用,但AFAIK是唯一的方法,因为android:inputType="phone|textPassword"被忽略了......

<EditText
    android:id="@+id/EditText01"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:password="true"
    android:inputType="phone" />
Run Code Online (Sandbox Code Playgroud)

  • inputType ="numberPassword"可能是最好的选项,但只有当你的应用程序的min SDK> = 3.0(Honeycomb)时它才可用 (2认同)

jt-*_*son 5

我相信这就是你想要的?

android:inputType="numberPassword"
Run Code Online (Sandbox Code Playgroud)

编辑:在问题(2010年)时,这可能不在API中,但对于当代开发,它是可用的.