zoukankan      html  css  js  c++  java
  • Android中的四种动画(一)

    TweenAnimation  变换动画(也叫作"补间动画"),有四种(alpha scale translate rote).

    FrameAnimation(也叫DrawableAnimation)  帧动画(需要用到xml文件)

    LayoutAnimation

    PropertyAnimation

    它们可以静态导入,或者动态导入.

    静态导入需要在res/anim文件夹中建立xml文件.然后用工具类加载.

    <?xml version="1.0" encoding="utf-8"?>  
    <set xmlns:android="http://schemas.android.com/apk/res/android"  
    android:fillEnabled="true"  
    android:fillAfter="true"  
       >    
        <alpha  
            android:duration="2000"  
            android:fromAlpha="1"  
            android:repeatCount="1"  
            android:repeatMode="reverse"  
            android:toAlpha="0" />  
    </set>  
    final Animation alpha = AnimationUtils.loadAnimation(this,  
                    R.anim.anim_alpha);  

    动态导入不需要xml文件.

    动态导入示例:

    Animation alpha = new AlphaAnimation(0.1f,1.0f);
    alpha.setDuration(5000);
    img.startAnimation(alpha);//img是ImageView对象

    LayoutAnimation可以应用在ViewGroup上

    例如:

    listView.setLayoutAnimation(...);

    动画之间还可以组合.

  • 相关阅读:
    指针
    Centos6.5 安装Vim7.4
    C++ Prime:指针和const
    C++ Prime:const的引用
    C++ Prime:函数
    C++ Prime:范围for语句
    python的oop概述
    脚本单独调用django模块
    xtrabackup备份之xbstream压缩
    MySQL8.0安装
  • 原文地址:https://www.cnblogs.com/BlogCommunicator/p/4870343.html
Copyright © 2011-2022 走看看