2

I would like to set the theme-appropriate ProgressBackgroundColorSchemeColor and colorSchemeColors of my Swipe Refresh Layout in XML. However, I can only seem to find solutions to do it programmatically like this one below.

TypedValue typedValue = new TypedValue();
int colorValue;
if (context.getTheme().resolveAttribute(R.attr.xxx, typedValue, true))
  colorValue = typedValue.data;
else
  colorValue = Color.TRANSPARENT;

mSwipeRefreshLayout.setColorSchemeColors(colorValue);

These attributes are also not recognized in XML; so is it at all possible?

Samuel Browne
  • 73
  • 1
  • 9

1 Answers1

-1

The arrow appears in each color for every turn.

mSwipeRefreshLayout.setColorSchemeResources(
  android.R.color.holo_blue_bright,
  android.R.color.holo_green_light,
  android.R.color.holo_orange_light,
  android.R.color.holo_red_light
);
S T
  • 1,068
  • 2
  • 8
  • 16
  • This like the solution I referenced, only sets the colors at run time rather than in the XML layout. I added the `mSwipeRefreshLayout.setColorSchemeColors(colorValue)` to my question though because I didn't actually make clear what method I was using to set the colors. – Samuel Browne Nov 10 '20 at 10:42