I am trying to change change TextInputLayout hint color programmatically. While settings
android:textColorHint="@color/redColor"
in xml works just fine and I get this:
and while editing
and that's what I want, but I need to set it dynamically
Now I TextInputLayout doesn't have setHintTextColor method but TextInputEditText does so I tried doing it like this:
editext.setHintTextColor(getColor(R.color.redColor))
But this doesn't work with editext which is child of TextInputLayout so even though TextInputLayout does support "android:textColorHint" attribute it doesn't support the "setHintTextColor" method I looked for ways to do it differently and I found people suggesting using "setHintTextAppearance" with predefined style, and that what I did, but it gives following result:
Here's what style looks like
<style name="AppRedText" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/redColor</item>
<item name="android:textColorHint">@color/redColor</item>
<item name="android:textSize">12sp</item>
</style>
How can I achieve "android:textColorHint" attribute behaviour programmatically?