动画差值器
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》
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》
相关文章推荐
- hibernate映射配置文件详解
- centos rpm包及命令学习
- LeetCode 5 最长回文子串 Manacher算法
- asp.net类文件中出现上下文中不存在HttpContext
- Android RelativeLayout布局属性应用
- linux 下的常用操作
- PHP中的字符串连接运算符
- 使用C++网络库libcurl
- eclipse注释模板设置
- 使用C++网络库libcurl
- swift学习代码笔记
- Android MI2S和PCM简要介绍
- arm-none-linux-gnueabi-gcc 下载地址
- eclipse功能<template>(模板)学习。e.g : 快速在代码中插入时间戳
- android_绘图的基础canvas,Paint
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name的解决方法
- 善用Eclipse的代码模板功能
- EasyDarwin开源流媒体服务器低延时直播之转发缓存跟进算法
- 强化:把treeview的QString路径转换为QModelIndex节点,有了节点就什么都好办了
- EasyDarwin开源流媒体服务器低延时直播之转发缓存跟进算法