Gauthier Gauthier - 2 years ago 140
Android Question

SwipeRefreshLayout App Theme

Is there a way to modify the color of the arrow in a SwipeRefreshLayout using theme ?

I know that you can use this code programaticaly

public void setColorSchemeResources (int... colorResIds)

But I'd like to have the arrow set to the theme of my app by default, and not having to change it in the code each time I use a SwipeRefrestLayout somewhere.

Answer Source

As of support v4 23.0.1 the only attribute pulled from xml in the SwipeRefreshLayout constructor is android.R.attr.enabled

Meaning no, the only way to set the colors, is in code.

However you could create an array resource of the color id's to hold your color combo and reference that rather than having the duplicated list throughout your code base. Not much better but at least a change then only requires touching a single file.

Edit 1: The above is still true as of 24.2.1

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download