Android: How to set password property in an edit text?

前端 未结 9 2039
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 05:59

I need to create a login form with \'username\' \'password\' fields and two buttons \'login\' and \'cancel\' in my android application.

I am using an alert dialog w

相关标签:
9条回答
  • 2020-12-14 06:29

    My search for a similar solution for Visual Studio 2015/Xamarin lead me to this thread. While setting the EditText.InputType to Android.Text.InputTypes.TextVariationVisiblePassword properly hid the password during user entry, it did not 'hide' the password if it was visible before the EditText Layout was rendered (before the user submitted their password entry). In order to hide a visible password after the user submits their password and the EditText Layout is rendered, I used EditText.TransformationMethod = PasswordTransformationMethod.Instance as suggested by LuxuryMode.

    0 讨论(0)
  • 2020-12-14 06:32

    You need to use PasswordTransformationMethod.getInstance() instead of new PasswordTransformationMethod().

    0 讨论(0)
  • 2020-12-14 06:34

    This is deprecated

    In xml of EditText iclude this attribute: android:password="true"

    Edit

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