티스토리 뷰




애니메이션 적용

viewpager.setPageTransformer(false, new ViewPager.PageTransformer() {
 @Override
    public void transformPage(View page, float position) {
        // do transformation here
        }
});


--------------------------------------------------------------------
page Apply the transformation to this page position Position of page relative to the current front-and-center 
position of the pager. 
0 is front and center. 1 is one full page position to the right, and -1 is one page position to the left.








Now you have a variable that goes from 0 to 1 (and the other way, respectively) if the user scrolls the ViewPager. What you do with it is up to your imagination; here are some basic examples. First, we’ll fade the pages in and out:
@Override
public void transformPage(View page, float position) {
    final float normalizedposition = Math.abs(Math.abs(position) - 1);
    page.setAlpha(normalizedposition);
}


These lines perform a scaling effect from and to 50%:
@Override
public void transformPage(View page, float position) {
final float normalizedposition = Math.abs(Math.abs(position) - 1);
page.setScaleX(normalizedposition / 2 + 0.5f);
page.setScaleY(normalizedposition / 2 + 0.5f);
}



The last example rotates the pages around their Z axis by 30 degrees; you don’t need to normalize for this one. The effect is similar to the cover flow UI pattern:
@Override
public void transformPage(View page, float position) {
page.setRotationY(position * -30);
}



퍼온 글 : http://howrobotswork.wordpress.com/2013/06/27/create-viewpager-transitions-a-pagertransformer-example/



개발사이트에서 제공하는 ViewPager 애니메이션

URL : http://developer.android.com/training/animation/screen-slide.html

댓글
최근에 올라온 글
최근에 달린 댓글
글 보관함
Total
Today
Yesterday