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.
Any suggestions?
This problem can be solved without using deprecated
android:password
. Use the following code snippet, but do not reverse the sequence of calls:Try this in XML & nothing changes in manifest file,
The simplest solution that I found for a numeric text entry that needed to be hidden (password style) was to use:
android:inputType="numberPassword"
Full example that worked for me:
Try with this:
More info HERE
I think you should use
android:password="true"
andandroid:numeric="integer"
. But as the Android documentation states (inR.attr.html
, not in theTextView
docs), these are deprectated and you should useandroid:inputType
. inputType takes flag, so you can mix mulitple possibilities. And I thinkandroid:inputType="number | password"
should work for you.You should specify
android:password="true"
if you want to support older devices too.Using the deprecated
may solve your problem.