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>
I decided to write this answer based on comments from previous one.
At first, you need to create the style for your counter, for example:
<style name="CounterStyle" parent="TextAppearance.AppCompat.Small">
<item name="android:textColor">@android:color/white</item>
<!--other parameters that you want to change -->
</style>
Then add this style to TextInputLayout:
app:counterTextAppearance="@style/CounterStyle"
That's all, it should works. Full code:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterTextAppearance="@style/CounterStyle"
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>
You can also use some style for the overflow counter:
app:counterOverflowTextAppearance="@style/YourOverflowTextStyleHere"
As described here (thanks @Sufian for the link)
Please add:
app:counterTextAppearance="@android:color/white"
to your TextInputLayout.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With