【问题标题】:Style SwipeRefreshLayout in r21 of support library支持库的 r21 中的样式 SwipeRefreshLayout
【发布时间】:2014-11-26 09:27:18
【问题描述】:

我在swipeRefreshLayout 中找不到有关如何设置新refreshIcon 样式的任何文档?

this.swipeRefreshLayout.setProgressBackgroundColor(R.color.feed_refresh_1);

这只是改变了刷新图标背景的<background color>,有没有办法改变箭头本身的颜色?

【问题讨论】:

    标签: android android-support-library swiperefreshlayout


    【解决方案1】:

    使用最新的 r21,您可以将旋转箭头的颜色更改为仅将一种颜色传递给以下方法之一:

    swipeRefreshLayout.setColorSchemeColors(Color.RED);
    

    或:

    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_red_dark);
    

    在 Android 5.0.2 上测试并运行,也应该适用于 v4 之后的所有其他版本。 祝你有美好的一天!

    【讨论】:

      【解决方案2】:

      使用this.swipeRefreshLayout.setColorSchemeColors(..);this.swipeRefreshLayout.setColorSchemeResources(..);

      Android API reference

      【讨论】:

        【解决方案3】:

        不确定您说的是哪个图标,据我所知,该布局只是顶部的一行。我使用 https://github.com/baoyongzhang/android-PullRefreshLayout 而不是官方的 SwipeRefreshLayout,它有 4 种样式,您可能是指材料设计。

        【讨论】:

        • 最新更新将线改为新的材料设计重新加载图标 -> 一个圆形的浮动动作按钮状活动指示器;)
        • aha,它可能依赖于 API,因为如果我现在使用 api 18 导入和使用 android.support.v4.widget.SwipeRefreshLayout,我有那一行。
        • 我认为这取决于支持库的版本,在 r 21 中出现图标
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-11-27
        • 1970-01-01
        • 1970-01-01
        • 2015-07-03
        • 1970-01-01
        • 2014-12-20
        • 2015-11-19
        相关资源
        最近更新 更多