Changing the color of TextInputLayout's Counter

418 Views Asked by At

I'm trying to change the color of TextInputLayout's counter

I've tried the accepted answers but they do not work.

https://stackoverflow.com/a/33880925/11110509

<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/til_custom_msg"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:hint="Message"
        app:counterEnabled="true"
        app:counterMaxLength="300"
    
        //Accepted answer one
        app:counterTextAppearance="@android:color/white">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/et_custom_msg"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="@color/colorWhite" />

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

Accepted answer two:

https://stackoverflow.com/a/41257235/11110509

<style name="CounterStyle" parent="TextAppearance.AppCompat.Small">
    <item name="android:textColor">@android:color/white</item>
    <!--other parameters that you want to change -->
</style>

app:counterTextAppearance="@style/CounterStyle"

The issue maybe because my TextInputLayout uses the material version

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

and theirs uses the support

<android.support.design.widget.TextInputLayout

If so, how can I do it with the Material one?

1

There are 1 best solutions below

0
On BEST ANSWER

Simply use

'app:counterTextColor="YOUR_PREFERRED_COLOR"'

Resource: CounterTextColor