java - SwipeRefreshLayout - the RecyclerView is not pulled down -


i have recyclerview gridlayoutmanager , when using swiperefreshlayout recyclerview not pulled down. how create effect of having gap between toolbar , recyclerview while refreshing?

xml:

    <progressbar         android:id="@+id/progressbar"         style="?android:attr/progressbarstylelarge"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center" />      <android.support.v4.widget.swiperefreshlayout         android:id="@+id/swipe_container"         android:layout_width="match_parent"         android:layout_height="match_parent">          <recyclerview             android:id="@+id/gridview"             android:layout_width="match_parent"             android:layout_height="match_parent" />      </android.support.v4.widget.swiperefreshlayout>  </framelayout> 

code:

swipelayout = (swiperefreshlayout) view.findviewbyid(r.id.swipe_container); swipelayout.setonrefreshlistener(this); 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);  gridview = (recyclerview) getactivity().findviewbyid(r.id.gridview); gridlayoutmanager = new gridlayoutmanager(getactivity(), 4, gridlayoutmanager.vertical, false); gridview.setlayoutmanager(gridlayoutmanager); gridview.setvisibility(view.gone); gridview.sethasfixedsize(false); gridview.setitemanimator(new defaultitemanimator()); 

your code okay, swiperefreshlayout not pull down grid view itself, demo check video. can use other libraries ulta-pull-to-refresh achieve desired effect!


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -