ho SwipeRefreshLayout
come in questo modo:SwipeRefreshLayout tirare più volte il comportamento (SDK 23)
.xml:
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<android.support.v7.widget.RecyclerView
android:id="@+id/haberRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
.java:
private SwipeRefreshLayout swipeLayout;
swipeLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
swipeLayout.setColorSchemeColors(getResources().getColor(R.color.primary_color));
swipeLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
refreshContent();
}
});
Questo mi permette tirare swipeRefresh
più volte a ND girando l'animazione diventa strano, a volte rimane sullo schermo senza circuitazione:
Al primo tiro appare un po 'in alto, al secondo tiro va giù un po' più come come sull'immagine.
Come disabilitare pull multiplo su SwipeRefresh
mentre è già in corso l'aggiornamento? Immagino che questo non accada sotto sdk 23. Sto usando buildTool 23, targetSdk 23, support-v4: 23, appcompat-v7: 23.
Aggiornamento: questo non accade se uso ListView
anziché RecyclerView
.
Grazie. funziona bene –