Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why attribute app:endIconMode is not found in TextInputLayout?

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

like image 207
acabezas Avatar asked Mar 16 '19 21:03

acabezas


People also ask

How do I remove the default padding in TextInputLayout?

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.

How do I get TextInputLayout from text?

Just use: TextInputLayout textInputLayout = findViewById(R. id. custom_end_icon); String text = textInputLayout.


1 Answers

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' 
like image 200
ianhanniballake Avatar answered Sep 20 '22 18:09

ianhanniballake