自定义动画(animation)时set中的各元素效果
淡入淡出动画效果
android:fromAlpha="1.0f" //起始透明度
android:toAlpha="0.0f" //结束透明度
android:duration="500" //动画持续时间(单位ms)
android:fromXScale="1.0"android:toXScale="1.4" //水平拉伸
android:fromYScale="1.0" android:toYScale="0.6" //垂直压缩
三种表示格式:
1.-100% 到 100% 相对自身的百分比
2.-100%P到100%P 相对父组件的百分比
3.folat value 没有后缀 表示绝对值
android:fromXDelta="100%p" android:toXDelta="0" //从父组件的右边界到中间
android:fromDegrees="0" //起始角度
android:toDegrees="-45" //结束角度 负数表示逆时针
多动画组合
//初始化 Translate动画
translateAnimation = new TranslateAnimation(0.1f, 100.0f,0.1f,100.0f);
//初始化 Alpha动画
alphaAnimation = new AlphaAnimation(0.1f, 1.0f);
//动画集
AnimationSet set = new AnimationSet(true);
set.addAnimation(translateAnimation);
set.addAnimation(alphaAnimation);
//设置动画时间 (作用到每个动画)
set.setDuration(1000);
this.startAnimation(set);
更多相关文章
- Android(安卓)Animation无限循环动画
- Android各控件常用属性
- Android(安卓)用ViewFlipper实现各种切换动画
- android:id设置的三种方式
- Android:Material Design(七) 兼容性
- Android:Material Design(三) 动画
- Android技能树 — 屏幕适配小结
- Android(安卓)Button 常用属性设置,圆角,边框,点击事件
- Android(安卓)Button 常用属性设置,圆角,边框,点击事件