I've implemented a pull to refresh in my app. I think it is right:
swipeLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_container);
swipeLayout.setOnRefreshListener(this);
swipeLayout.animate();
swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
swipeLayout.setRefreshing(false);
}
}, 5000);
}
boolean canChildScrollUp()
{
return resultado.getFirstVisiblePosition()!=0;
}
No errors and I think it's working fine. The problem is that I want to put an overscroll on the listview, not the message "Swipe to refresh", just the overscroll and I don't know how to implement it.