PageCurl animations on ViewPager transitions?

强颜欢笑 提交于 2019-12-22 04:27:09

问题


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:

  • https://github.com/harism/android_page_curl
  • https://github.com/MysticTreeGames/android-page-curl

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.


回答1:


Not a straight way..but, How about creating the bitmap of view group by getDrawingCache() method and pass the bitmap to library.




回答2:


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);


来源:https://stackoverflow.com/questions/15829408/pagecurl-animations-on-viewpager-transitions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!