• Android : How to switch between hide and view password

    It is really easy to achieve since the Support Library v24.2.0.
    What you need to do is just:
    1. Add the design library to your dependecies
      dependencies {
           compile "com.android.support:design:24.2.0"
      }
    2. Use TextInputEditText in conjunction with TextInputLayout
      <android.support.design.widget.TextInputLayout
          android:id="@+id/etPasswordLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:passwordToggleEnabled="true"
          android:layout_marginBottom="@dimen/login_spacing_bottom">
      
          <android.support.design.widget.TextInputEditText
              android:id="@+id/etPassword"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:hint="@string/fragment_login_password_hint"
              android:inputType="textPassword"/>
      </android.support.design.widget.TextInputLayout>
    The passwordToggleEnabled attribute will do the job!
    1. In your root layout don't forget to add xmlns:app="http://schemas.android.com/apk/res-auto"
    2. You can customize your password toggle by using:
    app:passwordToggleDrawable - Drawable to use as the password input visibility toggle icon.
    app:passwordToggleTint - Icon to use for the password input visibility toggle.
    app:passwordToggleTintMode - Blending mode used to apply the background tint.
  • 0 comments:

    Post a Comment

    FAVOURITE LINE

    To steal ideas from one is plagiarism. To steal from many is Research.

    ADDRESS

    Mumbai , Maharashtra

    EMAIL

    shikha.pathak6@gmail.com
    shikha.the.swt.pari@gmail.com

    Skype

    shikha_pari