I did a password visibilty toggle without using textInputLayout (Because I want the default ediText field feel).
How do I place the imageView beside the editText in layout which when clicked does the action for password visibility in my java code?
This is what I currently have..
I want that eye icon placed inside the editText field at the right.
My xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:gravity="center"
android:background="@color/white"
tools:context=".RegisterActivity"
android:fitsSystemWindows="true"
>
.......
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/etPassword"
android:layout_marginRight="20dp"
android:inputType="textPassword"
android:layout_marginLeft="20dp"
android:layout_marginBottom="20dp"
android:paddingLeft="20dp"
android:background="@drawable/input_border"
android:hint="Your Password" />
<ImageView
android:id="@+id/show_pass_btn"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:alpha=".5"
android:onClick="ShowHidePass"
android:padding="5dp"
android:src="@drawable/eye_show" />
.......
</LinearLayout>