I'm trying to create interface like
Central element is ViewPager
with full-size image, top element is RecyclerView
with preview images. But I couldn't find the way to magnet elements to center. Is there way to override behavior of RecyclerView
?
First of all, you can use this google official example to create visual effect of pulling this view to center. You'll have ImageView over ViewPager for displaying animated appearing. When animation will be finished, make make your ImageView Gone and show requested image in ViewPager.
The LinearLayoutManager have a scrollToPositionWithOffset method that takes both the position and also the offset of the start of the item from the start of the RecyclerView, which seems like it would accomplish what you need.
You can use this image slider(https://github.com/jjhesk/LoyalNativeSlider) instead of the ViewPager .
I found the solution exactly what you need. I created a small example on github.com: AndroidPreviewSlider
The thing is that top view is
ViewPager
and center view isViewPager
too. Detailed code is below:Adapter for top preview
Adapter for central view is simple
And one of the main is sync listener
And finally init
ViewPager
'sMore detailed code is in repo