淡出
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="500"
/>
</set>
<!--
fromAlpha:開始時(shí)透明度
toAlpha:結(jié)束時(shí)透明度
duration:動(dòng)畫持續(xù)時(shí)間
-->
淡入
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="500"
/>
</set>
旋轉(zhuǎn):
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromDegrees="300"
android:toDegrees="-360"
android:pivotX="10%"
android:pivotY="100%"
android:duration="10000" />
</set>
<!--
fromDegrees開始時(shí)的角度
toDegrees動(dòng)畫結(jié)束時(shí)角度
pivotX,pivotY旋轉(zhuǎn)圓心的
-->
縮放:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:interpolator= "@android:anim/decelerate_interpolator"
android:fromXScale="0.0"
android:toXScale="1.5"
android:fromYScale="0.0"
android:toYScale="1.5"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="0"
android:duration="10000"
android:repeatCount="1"
android:repeatMode="reverse"
/>
</set>
<!--
interpolator指定動(dòng)畫插入器,常見的有加速減速插入器accelerate_decelerate_interpolator,加速插入器accelerate_interpolator,減速插入器decelerate_interpolator。
fromXScale,fromYScale,動(dòng)畫開始前X,Y的縮放,0.0為不顯示,1.0為正常大小
toXScale,toYScale,動(dòng)畫最終縮放的倍數(shù),1.0為正常大小,大于1.0放大
pivotX,pivotY動(dòng)畫起始位置,相對(duì)于屏幕的百分比,兩個(gè)都為50%表示動(dòng)畫從屏幕中間開始
startOffset,動(dòng)畫多次執(zhí)行的間隔時(shí)間,如果只執(zhí)行一次,執(zhí)行前會(huì)暫停這段時(shí)間,單位毫秒
duration,一次動(dòng)畫效果消耗的時(shí)間,單位毫秒,值越小動(dòng)畫速度越快
repeatCount,動(dòng)畫重復(fù)的計(jì)數(shù),動(dòng)畫將會(huì)執(zhí)行該值+1次
repeatMode,動(dòng)畫重復(fù)的模式,reverse為反向,當(dāng)?shù)谂即螆?zhí)行時(shí),動(dòng)畫方向會(huì)相反。restart為重新執(zhí)行,方向不變
-->
平移
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="320"
android:toXDelta="0"
android:fromYDelta="480"
android:toYDelta="0"
android:duration="10000" />
</set>
<!--
fromXDelta,fromYDelta起始時(shí)X,Y座標(biāo),屏幕右下角的座標(biāo)是X:320,Y:480
toXDelta,toYDelta動(dòng)畫結(jié)束時(shí)X,Y的座標(biāo)
-->
閱讀原文
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。