문제

I am trying to dynamically change the font and background color of my app but when I try to set it just turns gray no matter what color I choose. I have verified the color is correct. any ideas.

mTitleText is a EditText

mTitleText = (EditText) findViewById(R.id.note_edit_title);
mTitleText.setTextColor(R.color.defaulttextred);
도움이 되었습니까?

해결책

Just use

mTitleText.setTextColor(getResources().getColorStateList(R.color.defaulttextred));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top