Android动画之Tween动画实战
<LinearLayout xmlns:apk="http://schemas.android.com/apk/res/android" apk:orientation="vertical" apk:layout_width="fill_parent" apk:layout_height="fill_parent">
<!-- 动画MM -->
<ImageView apk:id="@+id/TweenMM" apk:src="@drawable/tween" apk:layout_width="wrap_content" apk:layout_height="wrap_content"/>
<!-- 动画控制按钮 -->
<LinearLayout apk:layout_weight="1" apk:orientation="horizontal" apk:layout_width="fill_parent" apk:layout_height="wrap_content">
<Button apk:text="ScaleAnim" apk:layout_weight="1" apk:layout_width="fill_parent" apk:layout_height="wrap_content" apk:onClick="onBtnScaleAnimClick"/>
<Button apk:text="AlphaAnim" apk:layout_weight="1" apk:layout_width="fill_parent" apk:layout_height="wrap_content" apk:onClick="onBtnAlphaAnimClick"/>
</LinearLayout>
<LinearLayout apk:layout_weight="1" apk:orientation="horizontal" apk:layout_width="fill_parent" apk:layout_height="wrap_content">
<Button apk:text="TranslateAnim" apk:layout_weight="1" apk:layout_width="wrap_content" apk:layout_height="wrap_content" apk:onClick="onBtnTranslateAnimClick"/>
<Button apk:text="RotateAnim" apk:layout_weight="1" apk:layout_width="wrap_content" apk:layout_height="wrap_content" apk:onClick="onBtnRotateAnimClick"/>
</LinearLayout>
</LinearLayout>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.1" android:toAlpha="1.0" android:duration="5000" />
</set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:duration="5000" />
</set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="0.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="5000" />
</set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="10" android:toXDelta="100" android:fromYDelta="10" android:toYDelta="100" />
</set>
/*** Copyright (c) 2004-2011 All Rights Reserved.*/
package com.aboy.android.study.animation;import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;import com.aboy.android.study.R;/*** 通过XML配置文件的方式实现Tween动画** @author obullxl@gmail.com* @version $Id: TweenXMLActivity.java, v 0.1 2011-6-11 下午01:36:39 oldbulla Exp $*/
public class TweenXMLActivity extends Activity {public static final String TAG = "TweenActivity";// 动画图片private ImageView tweenMM;/** * @see android.app.Activity#onCreate(android.os.Bundle)*/public void onCreate(Bundle cycle) {super.onCreate(cycle);super.setContentView(R.layout.tween);// 取得动画图片this.tweenMM = (ImageView) super.findViewById(R.id.TweenMM);}/*** 按钮:尺寸变化动画*/public void onBtnScaleAnimClick(View view) {// 动画开始this.doStartAnimation(R.anim.tween_scale);}/*** 按钮:渐变动画*/public void onBtnAlphaAnimClick(View view) {// 动画开始this.doStartAnimation(R.anim.tween_alpha);}/*** 按钮:位置变化动画*/public void onBtnTranslateAnimClick(View view) {// 动画开始this.doStartAnimation(R.anim.tween_translate);}/*** 按钮:旋转动画*/public void onBtnRotateAnimClick(View view) {// 动画开始this.doStartAnimation(R.anim.tween_rotate);}/*** 开始动画*/private void doStartAnimation(int animId) {// 加载动画Animation animation = AnimationUtils.loadAnimation(this, animId);// 动画开始this.tweenMM.startAnimation(animation);}}
转载于:https://www.cnblogs.com/obullxl/archive/2011/06/13/android-animation-tween-lady.html
Android动画之Tween动画实战相关推荐
- 【Android】两种动画介绍(Tween动画、Frame动画)
Android中的动画类型有两种,一种是Tween动画.还有一种是Frame动画.Tween动画,这种实现方式可以使视图组件移动.放大.缩小以及产生透明度的变化;另一种Frame动画,传统的动画方法, ...
- android 同根动画_android 动画系列 (1) - tween 动画(view动画)
这是我这个系列的目录,有兴趣的可以看下: android 动画系列 - 目录 tween 动画早些时候我们也叫补间动画(我也不知道为啥),现在也有叫 view 动画的.tween动画是2.X 时代的产 ...
- Android动画之Tween Animation
Android动画里边主要分成两大类:一个是Frame动画,另一类则是Tween动画. Tween动画是操作某个控件让其展现出旋转.渐变.移动.缩放的这么一种转换过程,我们成为补间动画.我们可以以XM ...
- Android 动画分析之Tween动画分析
前言: 我们选择了android开发或ios开发,是不是见到不错的app,就想看看他们的一些动画效果,交互体验,以及一些有创意的功能.今天我们就来一起学习讲解android中的动画,以及动画原理,以便 ...
- Android工程师面试宝典面试实战试题详解01
1. 什么是Activity? 四大组件之一,一般的,一个用户交互界面对应一个activity setContentView() ,// 要显示的布局 , activity 是Context的子类,同 ...
- 【Android动画】之Tween动画 (渐变、缩放、位移、旋转)
Android 平台提供了两类动画. 一类是Tween动画,就是对场景里的对象不断的进行图像变化来产生动画效果(旋转.平移.放缩和渐变). 第二类就是 Frame动画,即顺序的播放事先做好的图像,与g ...
- android 左移动画_Android研究院之游戏开发Tween动画的实现(十九)
今天和大伙讨论一下Android开发中的Tween动画的实现.首先它和上一章我们讨论的Frame动画同属于系统提供的绘制动画的方法.Tween动画主要的功能是在绘制动画前设置动画绘制的轨迹,包括时间, ...
- 详解Android动画之Tween Animation
前面讲了动画中的Frame动画,今天就来详细讲解一下Tween动画的使用. 同样,在开始实例演示之前,先引用官方文档中的一段话: Tween动画是操作某个控件让其展现出旋转.渐变.移动.缩放的这么一种 ...
- Android自定义控件开发入门与实战(7)SVG动画,android底层架构
move to (50,23) line to(100,25) 而坐标并不是用width和height的坐标,而是viewportWidth和viewportHeight的坐标,(50,23)中50表 ...
最新文章
- 如何去除table的边框_如何擦玻璃,这些擦玻璃知识很实用
- java 下载文件文件名_java – 从http下载文件中检索文件名
- 变频器端子阻抗3k_PLC与变频器连接问题分析
- 反馈电路中相位补偿,到底是什么鬼?
- Qt实现界面的窗口的局部动态添加并布局
- __builtin_expect提高运行效率
- 测试用例集-8.公交卡测试用例
- 【论文笔记】HyperFace: ADeep Multi-task Learning Framework for Face Detection
- 变形监测与数据处理复习总结
- 微信小程序引入下载至本地的iconfont图标
- LoadRunner压力测试:测试报告结果分析
- 组合逻辑电路:一位全减器设计
- 乔治城大学计算机gre,2016年美国乔治城大学GRE成绩要求
- 降本增效这九个月,爱奇艺从“穿越火线”,到“冷静增长”
- C++ 数据存储类型
- CSDN旗下,河软CSDN乐知学院免费推荐诚信、踏实的Java软件工程、Android工程师,.NET工程师,PHP工程师、IOS工程师
- 树莓派远程控制(kali)
- 远程访问如此简单,通过 ZeroTier 和 Tailscale 轻松组建虚拟局域网,实现内网穿透。
- 基于支持向量机的机械零件剩余寿命区间估计
- 镇魂街qlv格式怎么转换成mp4格式