是否可以在 XML 中设置 SwipeRefreshLayout 的配色方案?

2022-09-01 19:33:37

我正在使用SwipeRefreshLayout

我知道如何动态地。setColorScheme

是否可以在 XML 中设置 SwipeRefreshLayout 的方案颜色?attribute


答案 1

这在2021年对我有用:

注意:现已弃用,因此请改用。setColorSchemesetColorSchemeResources

我在xml中设置了自己的颜色,并像.更改 xml 中的颜色会在所有位置更改它。swipeRefreshLayout.setColorSchemeResources(<color in xml>);


答案 2

是的,可以只设置设置ColorSchemesColors方法

swipeRefreshLayout.setColorSchemeColors(Color.BLUE, Color.YELLOW, Color.BLUE);

推荐