android 布局實現旋轉動畫效果

來源:互聯網
上載者:User

我們可以讓一個組件動起來,也可以讓幾個組件一起動起來,其實就是給五大布局設定動畫即可。

那麼,如何給Linearlayout等布局設定絢麗的動畫呢?

首先,要使用一個類,LayoutAnimationController。

其次,調用一個方法,layout.setLayoutAnimation(),並非是setAnimation().

實現方法有兩種,一種是在xml中的linearLayout設定android:layoutAnimation=“@anim/layoutanimation_layout”。

一種是在代碼中控制,使用LayoutAnimationController類。

第一種實現方式:

anim檔案夾中的兩個動畫檔案:

layoutanimation_layout:



layoutanimation:

        
第二種實現方式:

還是需要一個動畫檔案,如上,第二個檔案,layoutanimation。

java代碼:

//載入動畫Animation anim = AnimationUtils.loadAnimation(this, R.anim.list_anim);lac = new LayoutAnimationController(anim);//設定順序lac.setOrder(LayoutAnimationController.ORDER_REVERSE);//延時lac.setDelay(1);//布局設定動畫layout.setLayoutAnimation(lac);




:


<喎?http://www.bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+zai5/dXiuPbA/dfT1qTD97avu63Qp7n7yLTKx7fHs6O6xLfRxNq05qOs0OjSqtW5yr7RpMD2tcTQp7n7o6zU8tDo0qq4tNTTtcTL47eoo6xjdXC1xLi6taPSsr7N1Pa086GjPC9wPgo8cD7V4sDvyrnTw7XEysc1MTJNxNq05rXEyeixuLLiytSjrLzT1Ni2r7utuvPL+7XExNq05sq508PCytfuuN+077W9wcs4MyWjrDwvcD4KPHA+PGltZyBzcmM9"http://www.bkjia.com/uploadfile/Collfiles/20140102/2014010209553625.jpg" alt="\">

而,沒有載入動畫,單單顯示幾行資料,他的記憶體使用量率只有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.