我的视图寻呼机转换代码是:
@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);
}
}