我该如何以编程方式将我的TextView
的文本颜色设置为?android:textColorPrimary
?
我已经尝试过下面的代码,但它会将文本颜色始终设置为白色,无论是textColorPrimary还是textColorPrimaryInverse(它们都不是白色,我已经通过XML进行了检查)。
TypedValue typedValue = new TypedValue();
Resources.Theme theme = getActivity().getTheme();
theme.resolveAttribute(android.R.attr.textColorPrimaryInverse, typedValue, true);
int primaryColor = typedValue.data;
mTextView.setTextColor(primaryColor);
setTextColor
。我想为特定的TextView
将颜色从次要设置为主要。 - jaibatrikmTextView.setTextColor(android.R.attr.textColorPrimary);
- SRB Bans