添加Fragment的入场动画
public void replaceFragment(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
//添加Fragment的进入动画
transaction.setCustomAnimations(R.anim.anim_sild_down,0,R.anim.anim_sild_down,0)
.replace(R.id.frag_container, fragment)
.commit();}
R.anim.anim_sild_down
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/linear"
android:duration="1000" >
<translate
android:fromYDelta="100%p"
android:startOffset="0"
android:toYDelta="0" />
<scale
android:fromXScale="0.0"
android:toXScale="0.8"
android:fromYScale="0.0"
android:toYScale="0.8"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="0" />
</set>