Android 圖片的幀動畫

Android之中有 Obj 動畫 即 UI動畫 和 Image的Fragment動畫

①Image動畫

將一系列圖片照順序 排列 組成一個序列展示

       XML文件存放路徑: res/anim/filename.xml:

   通過使用rescoure id進行訪問

<?xml version="1.0" encoding="utf-8"?>
<animation-listxmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<itemandroid:drawable="@drawable/rocket_thrust1"android:duration="200"/>
<itemandroid:drawable="@drawable/rocket_thrust2"android:duration="200"/>
<itemandroid:drawable="@drawable/rocket_thrust3"android:duration="200"/>
</animation-list>

       使用動畫:

       ImageView rocketImage =(ImageView) findViewById(R.id.rocket_image)

       rocketImage.setBackgroundResource(R.drawable.rocket_thrust);

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