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、 回收();