java如何在运行时获取“colorControlHighlight”属性的值?
我看到这个post,它解释了颜色设置在colorControlHighlight
我尝试验证此属性的运行时值colorControlHighlight
但不确定检查这个的代码是什么
我如何知道使用哪个索引
TypedValue typedValue = new TypedValue();
int[] textSizeAttr = new int[] { 安卓.R.attr.colorControlHighlight };
int indexOfAttrTextSize = 0;
TypedArray c = view.getContext().obtainStyledAttributes(typedValue.data, textSizeAttr);
int selectableItemBackground = c.getColor(indexOfAttrTextSize, -1);
c.recycle();
# 1 楼答案
您可能需要检查this post
还要注意的是}
getColorStateList(int)
一直是deprecated since Android Marshmallow。您可能更喜欢使用^{