Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我如何获得“的值?”;colorControlHighlight";运行时的属性?_Java_Android_Styles_Android Theme - Fatal编程技术网

Java 我如何获得“的值?”;colorControlHighlight";运行时的属性?

Java 我如何获得“的值?”;colorControlHighlight";运行时的属性?,java,android,styles,android-theme,Java,Android,Styles,Android Theme,我看到了这一点,它解释了在colorControlHighlight 我尝试验证此属性的运行时值colorControlHighlight 但不确定检查这个的代码是什么 我如何知道使用哪个索引 TypedValue typedValue = new TypedValue(); int[] textSizeAttr = new int[] { android.R.attr.colorControlHighlight }; int indexOfAttrTextSize = 0; TypedArra

我看到了这一点,它解释了在
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();
你可能想检查一下


还请注意,
getColorStateList(int)
已被删除。你可能更喜欢使用它。

我已经看过你的帖子,但是我怎么知道该使用哪个索引呢;int[]textSizeAttr=newint[]{android.R.attr.colorControlHighlight};int indexofattertextsize=0;TypedArray c=view.getContext().ActainStyledAttributes(typedValue.data,textSizeAttr);int-selectableItemBackground=c.getColor(indexOfAttrTextSize,-1);c、 回收();