Vertical scroll the RecyclerView in Android by pixels
The best way to achieve this is using this:
recyclerView.smoothScrollBy(0, 100);
This is the signature of the method. You can scroll in x and y axis:
public void smoothScrollBy(int dx, int dy)
Note: If smothScrollBy(dx,dy)
does not work is due to the RecyclerView has not been already loaded with its elements. For that I would recomend using:
new Handler().postDelayed(new Runnable() {
@Override public void run() {
recyclerView.smoothScrollBy(0, 100);
}
}, 200);
In that way, you can be sure that the views have been loaded