自定义动画(animation)时set中的各元素效果

<alpha> 淡入淡出动画效果

   android:fromAlpha="1.0f"         //起始透明度

   android:toAlpha="0.0f"             //结束透明度

   android:duration="500"           //动画持续时间(单位ms)


<scale>  渐变尺寸伸缩动画效果

   android:fromXScale="1.0"android:toXScale="1.4"    //水平拉伸

   android:fromYScale="1.0"    android:toYScale="0.6"     //垂直压缩


<translate> 水平和/或垂直运动

三种表示格式:

   1.-100% 到 100% 相对自身的百分比

   2.-100%P到100%P 相对父组件的百分比

   3.folat value 没有后缀 表示绝对值


   android:fromXDelta="100%p"   android:toXDelta="0"  //从父组件的右边界到中间


<rotate> 旋转动画

   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);  


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章