-1

I saw this post which explains the color is set in colorControlHighlight

I try to verify the runtime value of this attribute colorControlHighlight

But not sure what's the code to check this

How can I know which index to use?

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();
Elad Benda
  • 35,076
  • 87
  • 265
  • 471

1 Answers1

0

You might want to check this post.

Also note that getColorStateList(int) has been deprecated since Android Marshmallow. You may prefer to use getColorStateList(int, android.content.res.Resources.Theme) instead.

Jon
  • 25
  • 1
  • 9
  • I have looked at your post, but how can i know which index to use? – Elad Benda May 29 '19 at 15:15
  • 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(); – Elad Benda May 29 '19 at 15:16