Post Reply

[Q]Making flip animation in section pageadapter

OP arpitkh96

12th April 2014, 12:35 PM   |  #1  
arpitkh96's Avatar
OP Senior Member
Flag panipat
Thanks Meter: 384
 
1,098 posts
Join Date:Joined: Feb 2012
More
I am trying to make a flip animation in section page adapter via following code but it doesnt works perfectly according to my expectations.
I want to make animation exact like launchers have

Code:
 mViewPager = (ViewPager) findViewById(R.id.pager);

mViewPager . setPageTransformer(true , new FlippY());
Animation class
Code:
 
public class FlippY implements ViewPager. PageTransformer {
public void transformPage ( View view , float position ) {
int pageWidth = view.getWidth();
if ( position<-1){ 
view.setAlpha(0);
} else if ( position<= 0) { 
view.setAlpha(1);

view.setRotationY(Math.round(180*position));
view . setScaleX(1);
view . setScaleY(1);
}
 else if (position<=1) { 
view.setAlpha (1-position);


view.setRotationY(Math.round(180*position));

view.setScaleX(1);
view.setScaleY(1);
} else { 
view.setAlpha(0);
}
}
}
So please suggest me modifications for this class so that animation looks perfect

Sent from my GT-S5570 using XDA Premium 4 mobile app
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Java for Android App Development by ThreadRank