What is the function of app:endIconCheckable in XML file of Android Studio?

Viewed 221

Below I have given the code, Here I was not able to understand the point of the line with code app:endIconCheckable, because whatever I set its value (True/False) it isn't showing and difference, Can anyone help me out in understanding and when should I use it when not?

<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/textInputLayout"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="50dp"
        android:layout_marginEnd="50dp"
        android:hint="@string/foot"
        app:counterEnabled="true"
        app:counterMaxLength="10"
        app:counterTextColor="@color/red_30k"
        app:helperText="@string/required"
        app:helperTextTextColor="@color/red_30k"
        app:endIconMode="custom"
        app:endIconDrawable="@drawable/ic_launcher_background"
        **app:endIconCheckable="false"**
        app:errorEnabled="true"
        app:layout_constraintBottom_toTopOf="@+id/textView7"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@id/editTextNumber"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:inputType="number"
            android:maxLength="10" />
    </com.google.android.material.textfield.TextInputLayout>
1 Answers

It does the same thing as setEndIconCheckable() called from Java/Kotlin:

Sets the current end icon to be checkable or not.

If the icon works just as a button and the fact that it's checked or not doesn't affect its behavior, such as the clear text end icon, calling this method is encouraged so that screen readers will not announce the icon's checked state.

I expect this to be used mostly if the drawable is a StateListDrawable and you have different artwork for the checked and normal states.

Related