Android Animation动画效果简介
AlphaAnimation 淡入淡出动画
<alpha>A fade-in or fade-out animation. Represents an AlphaAnimation.
attributes:
android:fromAlpha- Float. Starting opacity offset, where 0.0 is transparent and 1.0 is opaque.
- 动画开始时的透明度
android:toAlpha- Float. Ending opacity offset, where 0.0 is transparent and 1.0 is opaque.
- 动画结束时的透明度
For more attributes supported by <alpha>, see the Animation class reference (of which, all XML attributes are inherrited by this element).
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromAlpha="1.0"
android:toAlpha="0.5" />
要实现淡入淡出设置 android:fromAlpha 和android:toAlpha这俩个属性就可以了 还有一些其他属性可以参见Animation这个父类
android:duration="400" 动画持续的时间 单位毫秒
android:fillAfter="true|false" 如果fillAfter设为true,则动画执行后,控件将停留在动画结束的状态
android:fillBefore="true|false" 如果fillBefore设为true,则动画执行后,控件将回到动画开始的状态
android:startOffset="2000" 设置动画执行之前等待的时间(单位:毫秒)
android:repeatCount="5" 设置动画重复的次数
android:interpolator="@android:anim/linear_interpolator" 设置动画的变化速度
setInterpolator(new AccelerateDecelerateInterpolator()):先加速,后减速
setInterpolator(new AccelerateInterpolator()):加速
setInterpolator(new DecelerateInterpolator()):减速
setInterpolator(new CycleInterpolator()):动画循环播放特定次数,速率改变沿着正弦曲线
setInterpolator(new LinearInterpolator()):匀速
以及其他一些特定的动画效果
translate 实现滑动动画
<translate
android:duration="2000"
android:fromXDelta="-50%p"
android:fromYDelta="-50%"
android:toXDelta="0%p"
android:toYDelta="0%p" />
android:fromXDelta="" X轴偏移量起始时位置
android:toXDelta="" X轴偏移量结束时位置
android:fromYDelta="" Y轴偏移量起始时位置
android:toYDelta="" Y轴偏移量结束时位置
参数可以是 dp,%,%p
其中%是相对于控件本身的相对位置, %p是相对于父容器的位置
如果是%p 的意思是控件的 左边与上边 距离父容器的偏移量



<scale>标签为缩放节点
android:fromXscale="1.0" 表示开始时X轴缩放比例为 1.0 (原图大小 * 1.0 为原图大小)
android:toXscale="0.0"表示结束时X轴缩放比例为0.0(原图大小 *0.0 为缩小到看不见)
android:fromYscale="1.0" 表示开始时Y轴缩放比例为 1.0 (原图大小 * 1.0 为原图大小)
android:toYscale="0.0"表示结束时Y轴缩放比例为0.0(原图大小 *0.0 为缩小的看不到了)
android:pivotX="50%" X轴缩放的位置为中心点
android:pivotY="50%" Y轴缩放的位置为中心点
android:duration="2000" 动画播放时间 这里是2000毫秒也就是2秒
Android Animation动画效果简介的更多相关文章
- android Animation 动画效果介绍
Android的animation由四种类型组成 XML中 alpha 渐变透明度动画效果 scale 渐变尺寸伸缩动画效果 translate 画面转换位置移动动画效果 rotate 画面转移旋转动 ...
- Android中xml设置Animation动画效果详解
在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现,一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...
- android中设置Animation 动画效果
在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现,一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...
- Android Activity动画属性简介
Android Activity动画属性简介 在Android当中 设置activity的动画 需要复写 android:windowAnimationStyle这个属性 我们自定义一个动画样式来继承 ...
- Android Animation 动画属性
在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现: 一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...
- android Animation动画的xml使用
在Android应用程序,使用动画效果,能带给用户更好的感觉,做动画能够通过XML或Android代码来实现. Animation动画效果的实现能够通过两种方式进行实现,一种是tweened anim ...
- [Android]Animation 动画介绍和实现
Animation动画效果来实现菜单的显示和隐藏,本文就来介绍下吧. 1.Animation 动画类型 Android的animation由四种类型组成: XML中 alph 渐变透明度动画效果 sc ...
- Android Animation动画实战(二):从屏幕底部弹出PopupWindow
在这篇文章之前,我已经陆陆续续写了几篇博客,介绍了Android Animation是如何使用的,有还不明白的,可以点击查看: 1. Android Animation动画详解(一): 补间动画 2. ...
- Android Animation动画实战(一): 从布局动画引入ListView滑动时,每一Item项的显示动画
前言: 之前,我已经写了两篇博文,给大家介绍了Android的基础动画是如何实现的,如果还不清楚的,可以点击查看:Android Animation动画详解(一): 补间动画 及 Android An ...
随机推荐
- aop:declare-parents注解
http://www.blogjava.net/jackfrued/archive/2010/02/27/314060.html <aop:aspect> <aop:declare- ...
- 2017年WorkApplication牛客网线上机试题
WorkApplication是一家日企,主要办公地在东京.新加坡.上海等地. 第一题:n的全排列中有多少个排列逆序数为k 输入两个数字n,k,两个数字的范围都是[1,1000]. 输出:n的全排列中 ...
- 【LeetCode】48. Rotate Image (2 solutions)
Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees ...
- 使用SoapUI生成WS请求报文
WSDL地址示例:http://10.1.84.10:8100/webService/common/mail?wsdl 打开SoapUI,创建一个Project,输入wsdl地址就ok. 1.访问 ...
- 利用腾讯云免费证书打造全https站
什么是https? 超文本传输安全协议(Hypertext Transfer Protocol Secure,缩写为HTTPS)是一种网络安全传输协议http是HTTP协议运行在TCP之上,所有传输的 ...
- oc 类的使用
//定议一个Hello类,用@interface @end包着,并且继承NSObject @interface Hello : NSObject{ int num; }//包在大括号里面是私有的属性, ...
- 群智能优化算法-测试函数matlab源码
群智能优化算法测试函数matlab源代码 global M; creatematrix(2); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %画ackley图. %%%% ...
- extjs中组件监听器里面的回调函数说明
近期在看项目源代码的时候发现了例如以下代码,当中_searchSupplierStore是JsonStore对象 _searchSupplierStore.on('beforeload',functi ...
- [k8s]kubespray(ansible)自动化安装k8s集群
kubespray(ansible)自动化安装k8s集群 https://github.com/kubernetes-incubator/kubespray https://kubernetes.io ...
- [na]wac无线控制器集中转发部署的几种情况
1,背景: sta属于vlan20.ap属于vlan20.本地转发. 现象: Ap获取到的地址是vlan20的地址池的某地址 用户无法获取地址. 注意:本地转发,ap获取地址dhcp包不走隧道.用户获 ...