Android EditText for password with android:hint

前端 未结 9 1108
清歌不尽
清歌不尽 2020-12-13 03:21

Just noticed that android:password has been deprecated, and we should be using android:inputType. Was experimenting with it by setting in my xml

         


        
相关标签:
9条回答
  • 2020-12-13 04:13

    Hint is displayed correctly with

    android:inputType="textPassword"
    

    and

    android:gravity="center"
    

    if you set also

    android:ellipsize="start"
    
    0 讨论(0)
  • 2020-12-13 04:19

    Just stumbled on the answer. android:inputType="textPassword" does work with android:hint, same as android:password. The only difference is when I use android:gravity="center", the hint will not show if I'm using android:inputType. Case closed!

    0 讨论(0)
  • 2020-12-13 04:20

    If you set

    android:inputType="textPassword"
    

    this property and if you provide number as password example "1234567" it will take it as "123456/" the seventh character is not taken. Thats why instead of this approach use

    android:password="true"
    

    property which allows you to enter any type of password without any restriction.

    If you want to provide hint use

    android:hint="hint text goes here"
    

    example:

    android:hint="password"
    
    0 讨论(0)
提交回复
热议问题