amm965
amm965

Reputation: 459

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?

Upvotes: 2

Views: 681

Answers (1)

Mahesh Vayak
Mahesh Vayak

Reputation: 1106

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

Upvotes: 1

Related Questions