Android 控件抖动效果

Stella981
• 阅读 563

利用Android自带的动画效果,实现控件的抖动效果,效果资源文件shark.xml

<?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="500" 
    android:interpolator="@anim/cycle_7"
>
</translate>

使用非常简单

Animation shakeAnimation = AnimationUtils.loadAnimation(context, R.anim.shake);//加载动画资源文件
button.startAnimation(shakeAnimation);
点赞
收藏
评论区
推荐文章
Wesley13 Wesley13
2年前
android ContextMenu 上下文菜单示例
ch2\_contextmenu.xml:<?xmlversion"1.0"encoding"utf8"?<LinearLayoutxmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_p
东方客主 东方客主
3年前
Android输入法遮挡了输入框,使用android:fitsSystemWindows="true"后界面顶部出现白条
问题1、页面布局文件:<LinearLayoutxmlns:android"http://schemas.android.com/apk/res/android"android:id"@id/layoutorderdetail"android:layoutwidth"matchparent"android:layoutheigh
Wesley13 Wesley13
2年前
android Notification 状态栏通知使用示例
ch7\_notification.xml:<?xmlversion"1.0"encoding"utf8"?<LinearLayoutxmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_
Wesley13 Wesley13
2年前
android WebView 使用实例
主布局文件:<?xmlversion"1.0"encoding"utf8"?<LinearLayoutxmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_parent"
Wesley13 Wesley13
2年前
360项目
shape资源创建图片(重点)1.resdrawablexxx.xml<shapexmlns:android"http://schemas.android.com/apk/res/android"android:shape"rectangle"
Stella981 Stella981
2年前
Android toolbar 标题精确居中 不会因返回键偏移
1\.总的布局文件<android.support.design.widget.CoordinatorLayoutxmlns:android"http://schemas.android.com/apk/res/android"xmlns:app"http://schemas.android.com
Stella981 Stella981
2年前
Android 复选框 以及回显
activity\_main.xml<?xmlversion"1.0"encoding"utf8"?<LinearLayoutxmlns:android"http://schemas.android.com/apk/res/android"xmlns:app"http:/
Stella981 Stella981
2年前
Android控件ListView简易使用(使用ArrayAdapter)
<?xmlversion"1.0"encoding"utf8"?<TextViewxmlns:android"http://schemas.android.com/apk/res/android"android:id"@id/tv"android:la
Stella981 Stella981
2年前
LISTVIew 加分割线
分割线样式文件:<?xmlversion"1.0"encoding"utf8"?<layerlistxmlns:android"http://schemas.android.com/apk/res/android"<item<
Stella981 Stella981
2年前
Android选项卡TabHost功能和用法
1、布局文件<TabHostxmlns:android"http://schemas.android.com/apk/res/android"xmlns:tools"http://schemas.android.com/tools"android:id"@android:id/tabhost"