DiscreteScrollView discreteScrollView = findViewById(R.id.listview_images);
discreteScrollView.setOrientation(DSVOrientation.HORIZONTAL); //Sets an orientation of the view
discreteScrollView.setOffscreenItems(1); //Reserve extra space equal to (childSize * count) on each side of the view
discreteScrollView.setOverScrollEnabled(true);
discreteScrollView.setSlideOnFling(true);
MyAdapter adapter = new MyAdapter();
discreteScrollView.setAdapter(adapter);
discreteScrollView.setItemTransformer((item, position) -> {
ImageView imageView = item.findViewById(R.id.imageView);
imageView.setRotation(position * 180f);
item.setPivotX(item.getWidth() / 2.0f);
item.setPivotY(item.getHeight() / 2.0f);
float scale = 1 - 0.3f * Math.abs(position);
item.setScaleX(scale);
item.setScaleY(scale);
});
Here is how that looks: https://www.dropbox.com/s/vwf4vpvrsk89ewy/2020-11-05%2016-22-28.mp4?dl=0
For this I used this library: https://github.com/yarolegovich/DiscreteScrollView
But you could also use the other one (https://github.com/BCsl/GalleryLayoutManager) it works almost the same.
CLICK HERE to find out more related problems solutions.