15.安卓.切换动画渐变效果
case R.id.bt_next:
Intent intent = new Intent(this,SetupGudie2Activity.class);
//一定要把当前的activity从任务栈里面移除
finish();
startActivity(intent);
//设置activity切换时候的动画效果
overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);//进入动画效果, 退出动画效果
break;
}
必须在 StartActivity() 或 finish() 之后立即调用。
而且在 2.1 以上版本有效
alpha_in.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0.0" 完全透明
android:toAlpha="1.0" 完全不透明
android:duration="300" 300毫秒
>
</alpha>
alpha_out.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="1.0" 完全可见
android:toAlpha="0.0" 完全不可见
android:duration="300" 300秒
>
</alpha>
从方向移动:
translate_in.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="100%p"
android:toXDelta="0"
android:duration="400"
>
</translate>
translate_out.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0"
android:toXDelta="-100%p"
android:duration="400"
>
</translate>

浙公网安备 33010602011771号