(Smooth)ScrollToPosition doesn't work properly with RecyclerView

I’m using basic RecyclerView with GridLayoutManager. I observed that nor smoothScrollToPosition nor scrollToPosition works properly.

a) when using smoothScrollToPosition I often receive error from RecyclerView

  • PDF Library to rendering the PDF files in Android
  • Best practices for exposing multiple tables using content providers in Android
  • How to get Android Local Service instance
  • Creating a custom layout for preferences
  • Android - How to upload photo from the SD card to the Facebook wall
  • android:orientation=“vertical” does not work for TabWidget
  • “RecyclerView﹕ Passed over target position while smooth scrolling.”

    and RecyclerView is not scrolled properly (often it misses the targeted row). This is observed mostly when I’m trying to scroll to the 1st item of some row

    b) when using scrollToPosition it seems to work quite ok but most of the time I can see only the 1st item of the row and the rest are not displayed.

    Can you give me some hints how to make work properly at least one of the methods?

    Thanks a lot!

    Related posts:

    How can I speed Up my Android-openCV application?
    SQLiteConstraintException: error code 19: constraint failed — Android error
    How to deal with “${applicationid}” in Xamarin?
    Getting imageview size for Bitmap creation
    Using Skia in Android NDK
    how to show the missed call number in lock screen?
  • getting exception IndexOutOfBoundsException FragmentManagerImpl after sharing something to the apps
  • Android setBackgroundResource cause out of memory excepiton
  • Samsung Multiwindow crash
  • How Can I to Change Text Size in RemoteViews
  • Scanning and Editing Android App Memory Values Programmatically
  • Adding kSOAP dependency to Gradle project
  • 6 Solutions collect form web for “(Smooth)ScrollToPosition doesn't work properly with RecyclerView”

    Finally I was able to make it work! LinearLayoutManager.scrollToPositionWithOffset(int, int) did the trick.

    I also have same issue, but managed to fix the issue by Customizing SmoothScroller

    let Custom LayoutManager as below

    public class CustomLayoutManager extends LinearLayoutManager {
        private static final float MILLISECONDS_PER_INCH = 50f;
        private Context mContext;
        public CustomLayoutManager(Context context) {
            mContext = context;
        public void smoothScrollToPosition(RecyclerView recyclerView,
            RecyclerView.State state, final int position) {
            LinearSmoothScroller smoothScroller = 
                new LinearSmoothScroller(mContext) {
                //This controls the direction in which smoothScroll looks
                //for your view
                public PointF computeScrollVectorForPosition
                (int targetPosition) {
                    return CustomLayoutManager.this
                //This returns the milliseconds it takes to 
                //scroll one pixel.
                protected float calculateSpeedPerPixel
                    (DisplayMetrics displayMetrics) {
                    return MILLISECONDS_PER_INCH/displayMetrics.densityDpi;

    (documentation commented inside the code given above)Please set the above LayoutManager
    to the recyerview

    CustomLayoutManagerlayoutManager = new CustomLayoutManager(getActivity());

    by using the custom Layout manager

    also working well in my case u can use


    also if you want to adjust the speed of smoothScrollToPosition please override the

    private static final float MILLISECONDS_PER_INCH = 50f;

    in CustomLayoutManager.
    So if we put the value as 1f the smoothScrollToPosition will be faster like scrollToPosition.increasing value make delay and decreasing will make the speed of scroll.
    Hope this will useful.

    To scroll down to bottom from any position in the RecyclerView on clicking EditText.

    edittext.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    rv_commentList.postDelayed(new Runnable() {
                        public void run() {
                          rv_commentList.scrollToPosition(rv_commentList.getAdapter().getItemCount() - 1);
                    }, 1000);

    In My case,


    also did not work.


    works fine for me…

    Calling the recyclerView smoothScroll isn’t effective, as the recyclerView itself doesn’t handle its layout.

    What you should do is calling the layout manager scroll method instead.

    This should look something like this


    Try measuring item width or height and call smoothScrollBy(int dx, int dy).

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.