Recyclerview scrollToPosition does not work
<p>I have tried everything from the answers to the questions on stackoverflow, but I still could not figure this out. In one of my recyclerview, I was able to scroll to the desired position after a click of a button. On a different recyclerview (it was built similar to the first one), I was not able to scroll to the desired position.</p>

<p>This is the code for the recyclerview that worked:</p>

<pre><code>LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);

Button button = (Button) view.findViewById(R.id.button2);
button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        newFeedRecyclerView.smoothScrollToPosition(2);
    }
});

FeedRecyclerAdapter adapter = new FeedRecyclerAdapter(view.getContext(), allRows);
newFeedRecyclerView.setHasFixedSize(true);
newFeedRecyclerView.setLayoutManager(layoutManager);
newFeedRecyclerView.addItemDecoration(new VerticalSpaceItemDecorator(30));
newFeedRecyclerView.setAdapter(adapter);
</code></pre>

<p>And this is for the recyclerview that did not work:</p>

<pre><code>allImageRecycleView.addItemDecoration(new VerticalSpaceItemDecorator(30));
allImageRecycleView.setNestedScrollingEnabled(false);
allImageRecycleView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new &gt;LinearLayoutManagerWithSmoothScroller(getContext());

Button button = (Button)view.findViewById(R.id.button3);
button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        allImageRecycleView.smoothScrollToPosition(2);
    }
});
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
allImageRecycleView.setLayoutManager(layoutManager);

allImageRecycleView.setAdapter(allImageRecyclerAdapter); 
</code></pre>

<p>Thank you so much for reading this.</p>