How can I set custom dark colors for the SwipeRefreshLayout icon

Viewed 379

I want to customize the refresh icon so that the circular background is black and the animated ring is blue.

I tried calling:

pullRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.background));

but it didn't seem to affect the refresh icon at all. Am I using this incorrectly, or is there some other way to set custom colors?

1 Answers

setColorSchemeColors specifies the color of the ring, not the background. To color the ring blue, call:

pullRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.blue));

or more concisely:

pullRefreshLayout.setColorSchemeResources(R.color.blue);

To set the background color of the icon, call

pullRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.background);

Docs:

Related