大家好我有图像说image1和image2我想在计时器上显示两个图像,一次只能看到一个图像.两个图像都是重叠的,这意味着,image1在image2上.
所以,如果我使用计时器,我希望能够一次显示一个图像.我该怎么做呢.我希望我对自己的问题很清楚
将您的图像放在Drawable文件夹中.并在drawable文件夹中创建一个splash.xml文件,如下所示:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/splash_1" android:duration="200" />
<item android:drawable="@drawable/splash_2" android:duration="200" />
<item android:drawable="@drawable/splash_3" android:duration="200" />
<item android:drawable="@drawable/splash_4" android:duration="200" />
<item android:drawable="@drawable/splash_5" android:duration="200" />
</animation-list>
在你的活动课上
setContentView(R.layout.splashscreen);
final ImageView splashImage = (ImageView) findViewById(R.splash.ImageView);
splashImage.setBackgroundResource(R.drawable.splash);
splashAnimation = (AnimationDrawable) splashImage.getBackground();
splashAnimation.start();
Run Code Online (Sandbox Code Playgroud)