Here's a demo of what a page curl animation looks like: http://www.youtube.com/watch?v=aVZHN_o45sg
There are a couple of page curl animation libraries:
They are meant to work with Bitmap Drawables and not necessarily ViewGroups. If was wondering if anyone has come up with a similar page curl transition for ViewPagers.
It enables users to switch smoothly between fragments which have a common UI and it’s the best way to make your app extraordinary from others. ViewPagers provide visual continuity. They basically keep track of which page is visible and then ask PageAdapter to display the next page in the hierarchy.
Before we dive into code, let’s show off the finished effect (the source and sample apk can be found at the bottom of the article): As you can see, the background of the ViewPager animates gradually, so you can’t see the edges of adjacent views.
Normally when using ValueAnimator you would set the duration and start the animation by calling ValueAnimator#start (), but we’re only going to use the animator for determining the right color in each state of swiping between pages. To calculate the color we need to know what is the ViewPager currently showing.
Not a straight way..but, How about creating the bitmap of view group by getDrawingCache() method and pass the bitmap to library.
This is a library that I just come across; it has a nice page curl transformation. It is not the exact same page curl that you want; but maybe some remedy to anyone
How it looks
Dependency
implementation 'com.wajahatkarim3.easyflipviewpager:easyflipviewpager:1.0.0'
Usage
// Get ViewPager and Set Adapter
myViewPager = findViewById(R.id.myViewPager);
pagerAdapter = new MyPagerAdapter(this);
myViewPager.setAdapter(pagerAdapter);
// Create an object of page transformer
BookFlipPageTransformer bookFlipPageTransformer = new BookFlipPageTransformer();
// Enable / Disable scaling while flipping. If true, then next page will scale in (zoom in). By default, its true.
bookFlipPageTransformer.setEnableScale(true);
// The amount of scale the page will zoom. By default, its 5 percent.
bookFlipPageTransformer.setScaleAmountPercent(10f);
// Assign the page transformer to the ViewPager.
myViewPager.setPageTransformer(true, bookFlipPageTransformer);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With