您的位置:首页 > 其它

动画差值器

2016-06-21 00:27 197 查看
@Override

    public void onClick(View v) {

        switch (v.getId()) {

        case R.id.btn_number_address_query:

            String number = mEtNumber.getText().toString().trim();

            if (TextUtils.isEmpty(number)) {

                ToastUtil.showToast(getApplicationContext(), "号码不能为空");

                mEtNumber.requestFocus();

                Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);

                // shake.setInterpolator(new CycleInterpolator(7));

                shake.setInterpolator(new OvershootInterpolator(10.0f));

                mEtNumber.startAnimation(shake);

                

                return;
            }

<?xml version="1.0" encoding="utf-8"?>

<translate xmlns:android="http://schemas.android.com/apk/res/android"

    android:duration="1000"

    android:fromXDelta="0"

    android:toXDelta="10" />

<!-- <translate xmlns:android="http://schemas.android.com/apk/res/android"

    android:duration="1000"

    android:fromXDelta="0"

    android:interpolator="@anim/cycle_7"

    android:toXDelta="10" /> -->

《shake.xml 文件,在anim文件夹下》

<?xml version="1.0" encoding="utf-8"?>

<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"

    android:cycles="7" />

《在  anim文件夹下 cycle_7.xml》
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: