Android 横向模式公开密码

Android 横向模式公开密码,android,passwords,android-edittext,android-softkeyboard,Android,Passwords,Android Edittext,Android Softkeyboard,我在Galaxy Nexus上运行Android 4.2.2,在Nexus 5上运行Android 4.4,在Nexus 10上运行Android 4.4进行测试 在Nexus10上,一切都很好。在这两部手机上,如果我输入密码,然后将手机切换为横向,软键盘弹出,它会显示字符(在本例中,仅显示数字)。(在肖像中它们是隐藏的) 我的应用程序使用密码输入它。我的字段设置如下: <EditText android:id="@+id/etPasscode" and

我在Galaxy Nexus上运行Android 4.2.2,在Nexus 5上运行Android 4.4,在Nexus 10上运行Android 4.4进行测试

在Nexus10上,一切都很好。在这两部手机上,如果我输入密码,然后将手机切换为横向,软键盘弹出,它会显示字符(在本例中,仅显示数字)。(在肖像中它们是隐藏的)

我的应用程序使用密码输入它。我的字段设置如下:

  <EditText
        android:id="@+id/etPasscode"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="phone"
        android:maxLength="4"
        android:password="true" >

    <requestFocus />
</EditText>

我知道
password=“true”
已被弃用。但据我所知,如果你想把目标锁定在4.0之前的设备上,那么如果你想让数字键盘显示,并用密码方式屏蔽数字,就没有其他方法了。关于这一点,有很多堆积如山的问题,除了我的研究,没有其他真正的答案


我不确定此设置是否导致了横向错误

我在一个特定的设备上有过同样的经历,其中数字/文本变得可见。使用“numberPassword”作为输入类型 与您发布的示例中的输入类型“phone”相同

....
    android:inputType="numberPassword"
    android:password="true"
....



我使用的是基于4.1.2的HTC One,我快速尝试了一下您的xml,一切似乎都在我这边运行。密码在横向和纵向两种情况下都被屏蔽。您是否可能在不同的资源文件夹中有另一个同名的布局文件,但没有password=“true”?这也许可以解释为什么这种情况只发生在某些设备上。@EricSchlenz我检查了这个布局,并且只检查了一个布局。
<EditText
  android:id="@+id/password"
  android:layout_width="0dp"
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:inputType="numberPassword"
  android:maxLength="4"
  android:password="true"
  android:textColor="@android:color/black"
  tools:ignore="Deprecated" />