I want to set a background drawable for my TextInputLayout , this is my code :
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_repass"
android:layout_width="match_parent"
android:layout_height="37dp"
android:layout_marginTop="10dp"
app:hintEnabled="false"
android:layoutDirection="rtl"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/repass"
style="@style/edittexts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_repass"
android:drawableRight="@drawable/ic_https_grey600_18dp"
android:inputType="textPassword"
android:nextFocusDown="@+id/email" />
</android.support.design.widget.TextInputLayout>
the problem is, the icon is not appearing, the reason is that of passwordToggleEnabled
when I remove it, it shows the drawable
how to show both PasswordToggle Drawable
and background drawable
?
Use
android:drawableStart="@drawable/ic_launcher_round"
instead of
android:drawableRight="@drawable/ic_launcher_round"
Try this
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_repass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layoutDirection="rtl"
app:hintEnabled="false"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/repass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_launcher_round"
android:hint="nilu"
android:imeOptions="actionNext"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
NOTE : android:drawableStart="@drawable/ic_launcher_round"
is working because of android:layoutDirection="rtl"
OUTPUT