I am using TextInputLayout and TextInputEditText in my activity layout. Here is my xml code:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="@dimen/login_width"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/password_margin_top"
app:hintEnabled="false"
app:passwordToggleDrawable="@drawable/password_toggle_drawable"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/my_login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:hint="@string/password"
android:inputType="textPassword"
android:nextFocusDown="@+id/my_login_login"
android:padding="@dimen/field_padding" />
</com.google.android.material.textfield.TextInputLayout>
I want callback on clicking the password toggle icon. I found this on - documentation
When I call this method from the text input layout, it showing the cannot resolve symbol
.
Adding my code sample:
imported class: import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
Variable declaration: private TextInputLayout passwordTextInputLayout;
method usage
All the end icon related methods are not accessible. Those methods are removed?
Edit: I just decompiled the TextInputLayout class and checked the methods, I couldn't able to find the mentioned method in it.
I was using the 1.0.0 version of the material library. The setEndIconOnClickListener method was introduced in version 1.1.0 (no stable version of 1.1.0 is released yet). So, I have used the latest beta version to fix my problem.
implementation 'com.google.android.material:material:1.1.0-beta01'