1

Can you plz share any suggestion or library to achieve below,

enter image description here

e.g. If you see in Google Play Store, when you scroll HorizontalScrollView, your scrolling will stop as half of the next item user can able to see. App forcefully stops scroll like this so the user gets to know, there are more items available.

I do not have any code to share. I just want your hints/libs.

Thank you!

Samir Bhatt
  • 3,041
  • 2
  • 25
  • 39
Dhruv Patel
  • 1,529
  • 1
  • 18
  • 27

3 Answers3

3

You can achieve this by using Snaphelper in RecycleView its available in support libraries You can attached SnapHelper like this

SnapHelper startSnapHelper = new StartSnapHelper();
startSnapHelper.attachToRecyclerView(yourRecyclerView);
Burhanuddin Rashid
  • 5,260
  • 6
  • 34
  • 51
-1

You can achieve this task via using Horizontal recycler view and by adding pull to refresh technique. Set limited amount of items to be displayed by default and load on demand. Hope that answers your question.

Abdul Waheed
  • 4,540
  • 6
  • 35
  • 58
-1

You can change item's width dynamically based on device's width to manage this scenario.

horizontalScrollView.post(new Runnable() {

            @Override
            public void run() {
                DisplayMetrics dm = getResources().getDisplayMetrics();
                int screenWidth = dm.widthPixels;
                // based on this width, the space between the children and their
                // widths calculate new widths so you get a half clipped
                // children on the right side.
            }
        });
Samir Bhatt
  • 3,041
  • 2
  • 25
  • 39