问题描述
我想以XML设置我的“滑动刷新布局”的适合主题的ProgressBackgroundColorSchemeColor
和colorSchemeColors
。
但是,我似乎只能找到以编程方式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);
这些属性也无法用XML识别;那有可能吗?
解决方法
每转一圈,箭头就会以每种颜色显示。
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
);