Frage

Is there a way to get the hint color from an EditText?

I need the color to set it as the text color of the EditText too

War es hilfreich?

Lösung

I guess you could use this:

final ColorStateList colors = editText.getHintTextColors();
editText.setTextColor(colors);

Note that hint color is actually a ColorStateList.

Andere Tipps

Late response (but worth it). You can use:

<EditText
    ...
    android:textColor="?android:attr/textColorHint" />

You can make use of the getHintTextColors() API. Check this documentation.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top