あなたはこのように行う場合は、アニメーションやページ反転の完全な制御になります。
//ViewFlipper
ViewFlipper flipper;
//Four different animations
Animation OutToRight;
Animation OutToLeft;
Animation InFromRight;
Animation InFromLeft;
OutToRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
OutToRight.setDuration(500);
OutToRight.setInterpolator(new AccelerateDecelerateInterpolator());
OutToLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
OutToLeft.setDuration(500);
OutToLeft.setInterpolator(new AccelerateDecelerateInterpolator());
InFromRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
InFromRight.setDuration(500);
InFromRight.setInterpolator(new AccelerateDecelerateInterpolator());
InFromLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
InFromLeft.setDuration(500);
InFromLeft.setInterpolator(new AccelerateDecelerateInterpolator());
//Animating Left to page 1
flipper.setInAnimation(InFromLeft);
flipper.setOutAnimation(OutToRight);
flipper.setDisplayedChild(1);
//Animating right to page 2
flipper.setInAnimation(InFromRight);
flipper.setOutAnimation(OutToLeft);
flipper.setDisplayedChild(2);
私はいつも右のアニメーション化したい場合は何? – Vincenzo
その場合は、flipper.setInAnimation(InFromRight)を設定します。 flipper.setOutAnimation(OutToLeft);それらを変更しないでください。これらのアニメーションは、それ以降のsetDisplayedChildコールのために使用されます – andrrs
素晴らしい、ありがとう! – Vincenzo