I have a recycler view... and i want a smooth scrolldown and then scrollup to it programatically to show the complete content in it to user .... And i m able to do this by<
For those uninterested in overriding LinearLayoutManager (or whichever subclass you're using), you can just call startSmoothScroll(smoothScroller)
directly on the layout manager.
LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
@Override
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
return MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
}
};
linearSmoothScroller.setTargetPosition(position);
layoutManager.startSmoothScroll(linearSmoothScroller);