문제

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

도움이 되었습니까?

해결책

I guess you could use this:

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

Note that hint color is actually a ColorStateList.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top