Попробуйте,
С помощью viewflipper вы можете сделать это.
private Animation inFromTopAnimation() {
Animation inFromTop = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
inFromTop.setDuration(1000);
inFromTop.setInterpolator(new AccelerateInterpolator());
return inFromTop;
}
private Animation outToBottomAnimation() {
Animation outtoBottom = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, +1.0f
);
outtoBottom.setDuration(1000);
outtoBottom.setInterpolator(new AccelerateInterpolator());
return outtoBottom;
}
private Animation outToTopAnimation() {
Animation inFromTop = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
inFromTop.setDuration(1000);
inFromTop.setInterpolator(new AccelerateInterpolator());
return inFromTop;
}
private Animation outFromBottomAnimation() {
Animation outFromBottom = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f
);
outFromBottom.setDuration(1000);
outFromBottom.setInterpolator(new AccelerateInterpolator());
return outFromBottom;
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
flipper = (ViewFlipper) findViewById(R.id.flipper);
ImageView imgview1 = (ImageView) findViewById(R.id.imageview1);
Button button2 = (Button) findViewById(R.id.flipback);
imgview1.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
flipper.setInAnimation(inFromTopAnimation());
flipper.setOutAnimation(outToBottomAnimation());
flipper.showNext();
}
});
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
flipper.setInAnimation(outToTopAnimation());
flipper.setOutAnimation(outFromBottomAnimation());
flipper.showPrevious();
}
});