Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android EditText for password with android:hint

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

android:inputType="textPassword" 

Indeed it behaves like

android:password="true" 

for EditText, but it seems that if I use android:inputType, android:hint will not work. The EditText will be blank. There is no such issues when using android:password with android:hint. Am I missing something here about android:inputType?

like image 854
yjw Avatar asked Mar 22 '11 07:03

yjw


2 Answers

Hint is displayed correctly with

android:inputType="textPassword"

and

android:gravity="center"

if you set also

android:ellipsize="start"
like image 110
mango Avatar answered Oct 23 '22 11:10

mango


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!

like image 24
yjw Avatar answered Oct 23 '22 13:10

yjw