SwipeRefreshLayout Theme

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

I know you can use this programaticaly code

public void setColorSchemeResources (int... colorResIds) 

But I would like the arrow to be configured on the theme of my application by default, and there is no need to change it in the code every time I use SwipeRefrestLayout somewhere.

+5
source share
1 answer

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

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

However, you can create a resource of an array of color identifier to preserve the color combination and link, instead of having a duplicate list throughout the code base. Not much better, but at least a change, then you only need to touch one file.

Edit 1: The foregoing is still valid from 24.2.1.

+5
source

Source: https://habr.com/ru/post/1236237/


All Articles