Search code examples
androidandroid-design-library

How to set the color of the counter on a TextInputLayout?


I'm using a TextInputLayout wrapped around an EditText. Right now the counter is black, I'd like it to be white. I'm not sure what option to set to get it to be white.

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:counterEnabled="true"
        android:textColor="@color/white"
        android:textColorHint="@color/white"
        >

        <EditText
            android:id="@+id/myfield"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/white"
            android:hint="@string/myfield_hint"
            android:inputType="text"
            android:maxLength="26"
            android:textColor="@color/white"
            android:textColorHint="@color/white"/>
    </android.support.design.widget.TextInputLayout>

Solution

  • Please add:

    app:counterTextAppearance="@android:color/white"
    

    to your TextInputLayout.

    Hope this helps!