android - RecyclerView smoothScrollToPosition(0) dont work correctly -
i have recyclerview in fragment. when call smoothscrolltoposition(0) , first cell height larger phone height, recyclerview sometimes:
- show top of first cell in phone view
- show bottom of first cell (that means it's not top of
recyclerview
how can solve problem? want show top of first cell.
this recyclerview in fragment:
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.recyclerview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/feed_recycler_view" android:background="@color/colorlightgray" android:layout_width="match_parent" android:layout_height="wrap_content" /> and code scrolling top cell
recyclerview feedrecycler = (recyclerview)myview.findviewbyid(r.id.feed_recycler_view); feedrecycler.smoothscrolltoposition(0); when call smoothscrolltoposition(0), if top of first cell on screen, goes bottom of first cell otherwise goes bottom of first cell!! happens when cell larger screen.
when use below code it's worked fine.
feedrecycler.scrolltoposition(0);
wiki
Comments
Post a Comment