0

I'm trying to create a layout that looks like this:

enter image description here

And I haven't been able to find any examples where more than one card is visible at a time. I'd like the targeted card to SNAP to the center. Can someone please show me the secret?

szaske
  • 1,887
  • 22
  • 32
  • With a `RecyclerView` if the three items don't fit in the screen you will see something like that – Juan Cruz Soler Jan 24 '18 at 00:53
  • 1
    https://github.com/alibaba/UltraViewPager – Keyur Lakhani Jan 24 '18 at 01:38
  • 1
    https://stackoverflow.com/questions/39560767/how-to-create-horizontal-scroll-able-cardview – jessica Jan 24 '18 at 05:50
  • there are many solutions for this available with `VIewPager`. But if you want this to be done in `RecyclerView` only, let me search it for you. I think it is possible with `RecyclerView.ItemDecoration`. – Amrut Bidri Jan 25 '18 at 10:12
  • Check this answer: https://stackoverflow.com/questions/40584948/how-to-achieve-partially-visible-next-item-in-recyclerview/55242690#55242690 – Fathallah Mar 19 '19 at 16:21

2 Answers2

0

This link, helped decipher the problem. The trick is this view property called

android:clipToPadding="false"

That and a larger margin than I was expecting. A margin of 10-20dp was not large enough to see the other views in the list, because of the space between the recyclerview items. Once I increased the left and right margin to 80dp I got the effect I was looking for.

szaske
  • 1,887
  • 22
  • 32
-1

I think if you're going to achieve that effect, user LinearLayoutManager.HORIZONTAL Cannot be realized ,use viewpager can realized,I have done a similar effect one year ago,Hope help you

abby
  • 157
  • 4