发布于 2016-02-20 00:27:31 | 137 次阅读 | 评论: 0 | 来源: 网友投递
Android移动端操作系统
Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。
首先,可以在drawable文件夹下定义一个xml的文件。如下所示:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/compass_1" android:duration="70" />
<item android:drawable="@drawable/compass_2" android:duration="70" />
<item android:drawable="@drawable/compass_3" android:duration="70" />
<item android:drawable="@drawable/compass_4" android:duration="70" />
<item android:drawable="@drawable/compass_5" android:duration="70" />
</animation-list>
根标签为animation-list,其中oneshot代表着是否只展示一遍,设置为false会不停的循环播放动画。其中,每一个item是一帧,android:duration="400"表示每帧持续400ms,android:drawable是每帧要显示的图片。
接下来,代码中使用:
AnimationDrawable ad = (AnimationDrawable) getResources().getDrawable(R.drawable.bootanimation);
mView.setBackgroundDrawable(ad);