1

This code works as intended:

    LinearLayoutManager layoutManager = new LinearLayoutManager(this,
            LinearLayoutManager.VERTICAL, false);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.scrollToPosition(2);

The positioning and scroll are vertical and third item is displayed.

Now, if in the above code VERTICAL is replaced with HORIZONTAL, items are displayed horizontally and scroll is horizontal (as intended), but setScrollToPosition(2) doesn't work anymore.

How to scrollToPosition with HORIZONTAL LinearLayoutManager?

My XML file is mentioned below:

< android.support.v7.widget.RecyclerView
    android:id="@+id/rvPosters"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingTop="4dp"
    android:paddingBottom="4dp" >
Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53
Vlad
  • 820
  • 10
  • 29

0 Answers0