Search code examples
androidandroid-textinputlayout

passwordToggle is removing the drawable in TextInputEditText


I trying to create a password field with a lock icon on the left, and the passwordToggle icon on the right..... but I'm not able to show both icons at the same time.... how can I fix that?


Solution

  • Try this one:

      <android.support.design.widget.TextInputLayout
              android:id="@+id/textInputLayoutPassword"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginEnd="@dimen/margin_20dp"
              android:layout_marginStart="@dimen/margin_20dp"
              android:layout_marginTop="@dimen/margin_8dp"
              android:theme="@style/EditTextHint"
              app:errorTextAppearance="@style/error_appearance"
              app:hintTextAppearance="@style/hint_appearance"
              app:passwordToggleEnabled="true">
    
             <EditText
                    android:id="@+id/editTextPassword"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/L_PASSWORD"
                    android:inputType="textPersonName"
                    android:paddingBottom="@dimen/margin_20dp"
                    android:drawableStart="@drawable/ic_lock"
            tools:ignore="TextFields" />
      </android.support.design.widget.TextInputLayout>
    

    I have tried It working well :)

    o/p

    enter image description here