Hello I am creating an app with the androidx libraries but when I am trying to add a toggle to show or hide the password in an TextInputEditText with the app:endIconMode attribute I am getting the error error: attribute endIconMode not found.
This is my TextInputLayout and TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/password_text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="password"
app:endIconMode="password_toggle"
app:layout_constraintTop_toBottomOf="@+id/user_text_input_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password_text_input_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"/>
</com.google.android.material.textfield.TextInputLayout>
Also these are my dependencies in gradle
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.0.0'
I am not sure what i am missing, maybe a dependency? As far as i read in the documentation no extra dependency besides the material one is required.
Thanks
You can just set the start and end padding on the inner EditText to 0dp. Here's a screenshot with Show Layout Bounds turned on so you can see that the hints go all the way to the edge of the view.
Just use: TextInputLayout textInputLayout = findViewById(R. id. custom_end_icon); String text = textInputLayout.
As per the Material Design Components release notes:
1.1.0-alpha04
- Adding support for a custom end icon for the TextInputLayout. (5685941)
Therefore you must change your dependency to at least 1.1.0-alpha04
, not the 1.0.0
you are using:
implementation 'com.google.android.material:material:1.1.0-alpha04'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With