1.代码部分
Animation shake = AnimationUtils.loadAnimation(
getApplicationContext(), R.anim.shake);
et_search_place_getNumber.startAnimation(shake);
et_search_place_getNumber//是要震动的控件
R.anim.shake//是加载的震动动画
2.xml部分
1.这是R.anim.shake
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0"
android:toXDelta="10"
android:duration="1000"
android:interpolator="@anim/cycle_7" />
2.这是anim/cycle_7
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="7" />