android - ViewPager with multiple PageTransformer (PageTransformers at Runtime) -


i have custom requirement viewpager. want pager should have horizontal pagetransformer depthpagetransformer default. on screen have button on press of want current page slide on top bottom , next page replacing verticalpagetransformer , page changes page transformer should changed depthpagetransformer default one.

so want apply pagetransformers on runtime. appreciated.

here code:

//sets intial page transformer viewpager.setpagetransformer(false,new depthpagetransformer()); 

now when tap button in onclick have:

//sets vertical page transformer viewpager.setpagetransformer(false,new verticalpagetransformer()); viewpager.setcurrentitem(viewpager.getcurrentitem() + 1); 

then in onpageselected() set intial one

@override public void onpageselected(int position) {     viewpager.setpagetransformer(false,new depthpagetransformer()); } 

it sounds easy , correct page transformations not smooth @ all. behave weird. pages shrink @ time. page change fast 1 cannot see transformation.

edit @mimmo: changes attached

it's not best project of life, can find reference implementation downloading zip file. it's android studio project i've used:

mpager.beginfakedrag() mpager.fakedragby(float val); mpager.endfakedrag(); 

combined animation simulate smooth scroll of viewpager. viewpager has default depthpagetransformer 5 pages. when click bottom 'click me' button, page added viewpager, pagetransformer changed flipverticaltransformer , drag performed methods mentioned before.

i've made changes code in order implement verticalslide. believe answer can accepted :)


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

php - How do you embed a video into a custom theme on WordPress? -