• Android学习笔记_56_应用Tween动画 (渐变、缩放、位移、旋转)


    1、实现listview每个项先向右移动,再向左移动(回到原来位置)

    TranslateAnimation ta = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f,
                                          Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    ta.setDuration(500);
    view.startAnimation(ta);

      type:相对那个控件,value:移动多少。

    2、让EditText抖动效果:shake.xml和cycle_7.xml

    <?xml version="1.0" encoding="utf-8"?>
    <translate xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXDelta="0"
        android:interpolator="@anim/cycle_7"
        android:toXDelta="10" />
    <?xml version="1.0" encoding="utf-8"?>
    <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
        android:cycles="7" />
    <!--重复执行7次-->
    Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
    et_number.startAnimation(shake);//应用动画
  • 相关阅读:
    函数
    vue中v-for循环如何将变量带入class的属性名中
    代码规范 前端导航
    2019.8.5 mysql 删除 更新
    2019.8.1
    2019.7.31 Xshell简单学习
    日常使用知识点
    FormData实现文件多次添加累加上传和选择删除
    上传图片
    验证码
  • 原文地址:https://www.cnblogs.com/lbangel/p/3579813.html
Copyright © 2020-2023  润新知