有没有办法改变Chrisbanes PulToRefresh Actionbar的配色方案? 我已经阅读了快速入门(https://github.com/chrisbanes/ActionBar-PullToRefresh/wiki/QuickStart-Stock),但未提及。
提前致谢。
答案 0 :(得分:1)
因为如果您查看here,您会看到不推荐使用actionbar-pull-to-refresh方法,您可以使用以下内容!
1)检查example
2)编译此依赖项:compile 'com.android.support:support-v4:21.0.+'
3)修改布局文件:
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/activity_main_swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/activity_main_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
4)在您拥有ListView的活动中:
SwipeRefreshLayout mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//refresh your content and after your done call this method to stop refreshing
mSwipeRefreshLayout.setRefreshing(false);
});
5)您还可以自定义SwipeRefreshLayout的外观。要定义自己的自定义颜色方案以与SwipeRefreshLayout的动画加载图标一起使用,请使用适当命名的setColorSchemeResources()方法。
<resources>
<color name="orange">#FF9900</color>
<color name="green">#009900</color>
<color name="blue">#000099</color>
</resources>
希望它有所帮助!!!