26

I'm working with SwipeRefreshLayout.

I know how to setColorScheme dynamically.

Is it possible to set the scheme color attribute of SwipeRefreshLayout in XML?

Jared Rummler
  • 37,824
  • 19
  • 133
  • 148
Huy Tower
  • 7,769
  • 16
  • 61
  • 86
  • 2
    I ran into this problem also, did you find the answer? – Pike D. Mar 08 '17 at 23:07
  • 4
    @Pike D : Document does not have until now. But I think there is the way to do this, you use Data Binding with custom attribute, then link to @Binding method include code `setColorScheme`, should work. – Huy Tower Mar 14 '17 at 02:58

2 Answers2

2

This worked for me in 2021:

Note: setColorScheme is deprecated now so use setColorSchemeResources instead.

I set up my own colors in the xml and using them like swipeRefreshLayout.setColorSchemeResources(<color in xml>);. Changing the color in the xml changes it everywhere.

Stoobish
  • 1,202
  • 4
  • 23
-1

Yes, it is possible just set the setColorSchemesColors method

swipeRefreshLayout.setColorSchemeColors(Color.BLUE, Color.YELLOW, Color.BLUE);
AndroWaqar
  • 231
  • 2
  • 9