如何在View Pager Android中实现循环分页器转换?

时间:2019-01-21 06:06:13

标签: android android-viewpager

https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html#amazon-cognito-user-pools-server-side-authentication-flow

我的视图寻呼机转换代码是:

@Override     public void transformPage(查看页面,浮动位置){

    int pageWidth = page.getWidth();
    int pageHeight = page.getHeight();
    page.setPivotX((float) pageWidth/2);
    page.setPivotY((float) pageHeight/2);

    if (position < -1) { //[-infinity,1)
        //off to the left by a lot
        page.setRotation(0);
        page.setAlpha(0);
    } else if (position <= 1) { //[-1,1]
        page.setTranslationX((position)*pageWidth); //shift the view over
        page.setRotation(position * (90)); //rotate it
        // Fade the page relative to its distance from the center
        page.setAlpha(Math.max(1, 1 - Math.abs(position) / 3));

        Log.e("pos", "" + position);

    } else { //(1, +infinity]
        //off to the right by a lot
        page.setRotation(0);
        page.setAlpha(0);
    }

}

0 个答案:

没有答案