Last active
December 26, 2015 10:00
-
-
Save ccjeng/5b2bb1820895955c7f27 to your computer and use it in GitHub Desktop.
Android SwipeRefreshLayout Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private SwipeRefreshLayout mSwipeLayout; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
...... | |
mSwipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); | |
mSwipeLayout.setOnRefreshListener(this); | |
mSwipeLayout.setColorSchemeResources(android.R.color.holo_red_light, | |
android.R.color.holo_blue_light, | |
android.R.color.holo_green_light, | |
android.R.color.holo_orange_light); | |
...... | |
} | |
@Override | |
public void onRefresh() { | |
new Handler().postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
//refresh data | |
mSwipeLayout.setRefreshing(false); | |
} | |
}, 3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment