zoukankan      html  css  js  c++  java
  • 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);//应用动画
  • 相关阅读:
    单词 统计
    第十周学习记录
    梦断代码阅读笔记03
    梦断代码阅读笔记02
    梦断代码阅读笔记01
    用户模板和用户场景
    第九周学习记录
    分享好友-分享朋友圈
    生命周期函数-页面刷新
    底部导航的设置
  • 原文地址:https://www.cnblogs.com/lbangel/p/3579813.html
Copyright © 2011-2022 走看看