有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

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) 个答案