上一篇:http://www.bkjia.com/kf/201208/148861.html
本例顯示ListView將從下到上(Reverse Order)顯示清單項目。本例的用法在Android ApiDemos樣本解析(95):Views->Animation->3D Transition 已有說明:
看一下@anim/layout_bottom_to_top_slide” 的定義:
[html]
<layoutAnimation xmlns:android=”http://schemas.android.com/apk/res/android”
android:delay=”130%”
android:animationOrder=”reverse”
android:animation=”@anim/slide_right” />
<layoutAnimation xmlns:android=”http://schemas.android.com/apk/res/android”
android:delay=”130%”
android:animationOrder=”reverse”
android:animation=”@anim/slide_right” />
對應LayoutAnimation 可以定義:
delay: 定義每個子View開始動畫延遲時間。
animationOrder: 枚舉Layout中子View的順序,可以為normal (正序),reverse(倒序),random(隨機順序)。
animation: 每個子View 所採用的動畫效果,本例為@anim/slide_right,效果是文字從左至右移動。
interpolator:幀插值演算法,定義了動畫的變化速率,動畫的各幀的顯示可以加速,減速,重複顯示等。
@anim/slide_right 的定義如下:
<set xmlns:android=”http://schemas.android.com/apk/res/android”
android:interpolator=”@android:anim/accelerate_interpolator”>
<translate android:fromXDelta=”-100%p” android:toXDelta=”0″
android:duration=”1000″ />
< /set>
修改了一下duration 的值1 秒,使的更容易看到動畫效果。