Android ApiDemos樣本解析(128):Views->Layout Animation-&am

來源:互聯網
上載者:User

上一篇: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 秒,使的更容易看到動畫效果。

 
 

 


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.