当用户没有输入任何的号码的时候,当用户点击查询按钮的时候,输入框抖动起来。
if (TextUtils.isEmpty(phoneNumber)) {
//
Toast.makeText(this, "号码为空!", Toast.LENGTH_LONG).show();
Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake);
ed_phone.startAnimation(animation);
return;
}
shake的属性:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromXDelta="0"
android:toXDelta="10"
android:interpolator="@anim/cycle_7"
>
</translate>
<?xml version="1.0" encoding="utf-8"?>
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="7"
/>