Georgy
Georgy

Reputation: 384

Ussing app:helperTextColor in TextInputLayout

I'm trying to change the color of the helper text of TextInputLayout without any success. Setting app:helperTextColor attribute gives me the following error:

AAPT: error: attribute helperTextColor (aka com.mypackage:helperTextColor) not found.

Here is the link to the material site: link

This is what I'm trying to change: enter image description here

Here is the code:

  <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/webSiteInput"
        style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/standard_24"
        android:layout_marginStart="@dimen/standard_32"
        android:layout_marginEnd="@dimen/standard_32"

        app:errorEnabled="true"
        app:error="@{viewModel.errorMessage}"
        app:errorTextColor="@color/color130"
        app:errorIconDrawable="@null"

        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/toolbarAddSite"

        android:textColorHint="@color/color100"
        app:hintTextColor="@color/color100"
        android:hint="@{viewModel.hintText}"

        app:helperTextColor="@color/red"
        app:helperText="Test the color of the helper text"
        app:endIconMode="none"

        app:boxStrokeColor="@color/color94"
        app:boxStrokeErrorColor="@color/color130"
        tools:hint="Test the hint">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textUri"
            android:lines="1"
            android:textColor="@color/color95"
            android:text="@={viewModel.url}" />

    </com.google.android.material.textfield.TextInputLayout>

Upvotes: 0

Views: 585

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364654

You have to use the helperTextTextColor attribute:

 <com.google.android.material.textfield.TextInputLayout
   app:helperTextTextColor="@color/...."
   ../>

enter image description here

Upvotes: 1

Related Questions