xml实现

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:ordering="together" >

    <objectAnimator
        android:duration="3000"
        android:propertyName="alpha"
        android:valueFrom="0"
        android:valueTo="1" >
    </objectAnimator>
    <objectAnimator
        android:duration="4000"
        android:propertyName="scaleX"
        android:valueFrom="0.5"
        android:valueTo="1"
        android:valueType="floatType" >
    </objectAnimator>
    <objectAnimator
        android:duration="5000"
        android:propertyName="scaleY"
        android:valueFrom="0.5"
        android:valueTo="1" >
    </objectAnimator>

</set>
Animator animator = AnimatorInflater.loadAnimator(this, R.animator.set);
        animator.setTarget(imageview);
        animator.start();

下面是java代码实现

// 透明度属性动画
public void alpha(View view) {

    ObjectAnimator object_anim = ObjectAnimator.ofFloat(imageview, "alpha", 0,1.0f);
    //设置持续时间。
    object_anim.setDuration(3000);
    //启动动画。.
    object_anim.start();
}

//缩放属性动画。
public void scale(View view) {
    ObjectAnimator scale_anim = ObjectAnimator.ofFloat(imageview, "scaleX", 0.5f,2);
    scale_anim.setDuration(5000);
    scale_anim.setRepeatCount(0);
    ObjectAnimator scale_anim_y = ObjectAnimator.ofFloat(imageview, "scaleY", 0.5f,2);
    scale_anim_y.setDuration(5000);
    scale_anim_y.setRepeatCount(0);
    scale_anim_y.start();
    scale_anim.start();
}

//位移属性动画
public void translate(View view) {
    ObjectAnimator translate_anim = ObjectAnimator.ofFloat(imageview, "shadowDx", 0,200);
    translate_anim.setDuration(3000);
    translate_anim.setRepeatCount(0);
    translate_anim.start();
}

//旋转属性动画
public void rotate(View view) {
    ObjectAnimator translate_anim = ObjectAnimator.ofFloat(imageview, "translateX", 0,200);

}

*属性动画的监听方法

animator.addListener(new AnimatorListener() {

    @Override
    public void onAnimationStart(Animator animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationRepeat(Animator animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationEnd(Animator animation) {
        //跳转。
        Intent intent = new Intent(MainActivity.this,SecondActivity.class);
        startActivity(intent);

    }

    @Override
    public void onAnimationCancel(Animator animation) {
        // TODO Auto-generated method stub

    }
});

布局

属性动画PropertyAnimation的更多相关文章

  1. Android动画总结#补间动画(Tween Animation/View Animation) #帧动画(Frame Animation/Drawable Animation)#属性动画(PropertyAnimation)

    1.共有三种动画,英文名字多种叫法如下 第一种动画:补间动画(Tween Animation/View Animation) 四个:RotateAnimation旋转. AlphaAnimation透 ...

  2. Android中PropertyAnimation属性动画详解(一)

    在之前的文章中已经讲了帧动画frame-by-frame animation和补间动画tweened animation,其实这两种动画原理好简单,都是按照预先固定的动画模式来播放的,帧动画将一张张单 ...

  3. Android笔记(六十五) android中的动画——属性动画(propertyanimation)

    补间动画只能定义起始和结束两个帧在“透明度”.“旋转”.“倾斜”.“位移”4个方面的变化,逐帧动画也只能是播放多个图片,无法满足我们日常复杂的动画需求,所以谷歌在3.0开始,推出了属性动画(prope ...

  4. 使用属性动画 — Property Animation

    属性动画,就是通过控制对象中的属性值产生的动画.属性动画是目前最高级的2D动画系统. 在API Level 11中添加.Property Animation号称能控制一切对象的动画,包括可见的和不可见 ...

  5. 使用属性动画 — Property Animation

    属性动画,就是通过控制对象中的属性值产生的动画.属性动画是目前最高级的2D动画系统. 在API Level 11中添加.Property Animation号称能控制一切对象的动画,包括可见的和不可见 ...

  6. Android动画基础——属性动画(Property Animation)

    本篇涉及例子下载:Github 本篇讲android 3.0引入的属性动画框架,上篇写视图动画View Animation时就说过ViewAnimation的缺点,那就是动画作用的是view本身的视觉 ...

  7. Android动画效果之Property Animation进阶(属性动画)

    前言: 前面初步认识了Android的Property Animation(属性动画)Android动画效果之初识Property Animation(属性动画)(三),并且利用属性动画简单了补间动画 ...

  8. Android动画效果之初识Property Animation(属性动画)

    前言: 前面两篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画).Frame Animation(逐帧动画)Andr ...

  9. Android属性动画

    这几天看郭神的博客 Android属性动画完全解析(上),初识属性动画的基本用法之后,我自己突然想实现一种动画功能,就是我们在携程网.阿里旅行等等手机APP端买火车票的时候,看到有选择城市,那么就有出 ...

随机推荐

  1. thinkphp-1

    thinkphp网站: http://thinkphp.cn, http://bbs.thinkphp.cn 在设置文件夹查看试图的时候, 只点" 应用到所有文件夹" 不要点&qu ...

  2. ListView异步加载网络图片完美版之双缓存技术

    本示例参考学习了一个国外的示例:http://code.google.com/p/android-imagedownloader/,有兴趣的同学下载研究一下. 问题描述:在这一篇博客中将会为大家讲解如 ...

  3. 使用 nginx + thin 的配置启动 rails server

    http://www.iwangzheng.com 在大师的指导下配置了新的服务器的nginx,通过top命令查看了服务器是8个cpu的,所以起了8个端口,把它们都映射到一个总的端口3600上,需要在 ...

  4. Coursera台大机器学习技法课程笔记02-Dual Support Vector Machine

    这节课讲的是SVM的对偶问题,比较精彩的部分:为何要使用拉格朗日乘子以及如何进行对偶变换. 参考:http://www.cnblogs.com/bourneli/p/4199990.html http ...

  5. ZeroMQ(java)中对IO的封装(StreamEngine)

    哎,各种各样杂七杂八的事情...好久没有看代码了,其实要搞明白一个与IO相关的框架,最好的办法就是把它的I/0的读写两个过程搞清楚...例如在netty中,如果能将eventLoop的运行原理搞清楚, ...

  6. System.SysUtils.TMarshaller 与 System.TMarshal

    转自:http://www.cnblogs.com/del/archive/2013/06/10/3130974.html TMarshaller(结构) 基于 TMarshal(是有一大堆的 cla ...

  7. 每天一个脚本解析day1==》《service xxxxx status》之service脚本解析

    vim    /sbin/service #!/bin/sh . /etc/init.d/functions #读取环境变量. VERSION="$(basename $0) ver. 0. ...

  8. vlan与交换机端口模式Access,Hybrid,Trunk

    以太网端口有三种链路类型:Access.Hybrid和Trunk.Access类型的端口只能属于1个VLAN,一般用于连接计算机的端口:Trunk类型的端口可以允许多个VLAN通过,可以接收和发送多个 ...

  9. IOC原理解释

    spring ioc它其实是一种降低对象耦合关系的设计思想,通常来说,我们在一个类调用另一个类的方法的时候,需要不断的new新的对象来调用该方法,类与类之间耦合度比较高,有了ioc容器以后,ico容器 ...

  10. Java for LeetCode 062 Unique Paths

    A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The ...