【发布时间】:2019-10-15 02:24:12
【问题描述】:
我看到了这个post,它解释了颜色是在colorControlHighlight中设置的
我尝试验证这个属性colorControlHighlight的运行时值
但不确定检查的代码是什么
我如何知道要使用哪个索引?
TypedValue typedValue = new TypedValue();
int[] textSizeAttr = new int[] { android.R.attr.colorControlHighlight };
int indexOfAttrTextSize = 0;
TypedArray c = view.getContext().obtainStyledAttributes(typedValue.data, textSizeAttr);
int selectableItemBackground = c.getColor(indexOfAttrTextSize, -1);
c.recycle();
【问题讨论】:
标签: java android styles android-theme