在item_transaction.xml中设置循环的图片列表
ViewGroup viewGroup = ActivityUtils.getRootViewGroup(this);
viewGroup.setBackgroundResource(R.drawable.item_transaction);
m_BackgroundDrawable = (AnimationDrawable)viewGroup.getBackground();drawable资源
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item
android:drawable="@drawable/welcome_1"
android:duration="1000"/>
<item
android:drawable="@drawable/welcome_2"
android:duration="1000"/>
<item
android:drawable="@drawable/welcome_3"
android:duration="1000"/>
</animation-list>
本文介绍如何使用XML文件定义一个循环显示的图片列表,并通过AnimationDrawable实现这一效果。具体步骤包括创建animation-list类型的XML资源文件,指定每个帧的图片及显示时间,最后将此动画设置为指定ViewGroup的背景。
1832

被折叠的 条评论
为什么被折叠?



