1. 动画: 颤动
1.1 anim/shake.xml
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromXDelta="0"
android:interpolator="@anim/cycle_7"
android:toXDelta="10" />
1.2 anim/cycle_7
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="7" />
1.3 实现颤动效果
TextView tv = findViewById(R.id.tv);
Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
tv.startAnimation(shake);
2. 界面之间 Activity 切换动画效果: 水平移动效果(其他动画类似)
2.2 anim/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>
2.3 anim/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>
2.4 界面切换效果实现
Intent intent = new Intent(this, MyActivity.class);
finish();
startActivity(intent);
//activity 切换效果
overridePendingTransition(R.anim.translate_in, R.anim.translate_out);