package com.marshalchen.common.demoofui.sampleModules; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.support.v4.widget.SwipeRefreshLayout; import com.marshalchen.common.demoofui.R; import com.marshalchen.common.usefulModule.AbstractSwipeRefreshActivity; public class SwipeRefreshLayoutDemo extends AbstractSwipeRefreshActivity { // SwipeRefreshLayout swipeLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.swipe_refresh_layout_demo); enableSwipe(); // swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); // swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { // @Override // public void onRefresh() { // new Handler().postDelayed(new Runnable() { // @Override // public void run() { // swipeLayout.setRefreshing(false); // } // }, 1000); // } // }); // swipeLayout.setColorScheme(android.R.color.holo_blue_bright, // android.R.color.holo_green_light, // android.R.color.holo_orange_light, // android.R.color.holo_red_light); } @Override public void onRefresh() { super.onRefresh(); new Handler().postDelayed(new Runnable() { @Override public void run() { refreshLayout.setRefreshing(false); } }, 1000); } }