您好,欢迎访问成都祈钰瑶科技有限公司!

全国咨询热线

18982081108
✕

成都网站建设公司,成都网站UI设计,成都网站安全维护,成都网站内容优化服务

Android图片的帧动画

Android之中有 Obj 动画 即 UI动画 和 Image的Fragment动画

成都创新互联成立于2013年,先为都兰等服务建站,都兰等地企业,进行企业商务咨询服务。为都兰企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

①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_p_w_picpath)

       rocketImage.setBackgroundResource(R.drawable.rocket_thrust);

rocketAnimation=(AnimationDrawable) rocketImage.getBackground();
rocketAnimation.start();