mViewFlipper = (ViewFlipper) findViewById(R.id.viewFlipper); mViewFlipper.setInAnimation(this, R.anim.abc_slide_in_bottom); mViewFlipper.setOutAnimation(this, R.anim.abc_slide_out_bottom);
You can also define custom animation in an xml file and save it in res/anim folder, then call setInAnimation or setOutAnimation as follows:
res/anim/fade_out.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <alpha android:fromAlpha="1.0" android:toAlpha="0.1" android:duration="2000" /> </set>
mViewFlipper = (ViewFlipper) findViewById(R.id.viewFlipper); mViewFlipper.setOutAnimation(this, R.anim.fade_out);
No comments:
Post a Comment