大家好 我必须对图片说 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>
在你的 Activity 课上
setContentView(R.layout.splashscreen);
final ImageView splashImage = (ImageView) findViewById(R.splash.ImageView);
splashImage.setBackgroundResource(R.drawable.splash);
splashAnimation = (AnimationDrawable) splashImage.getBackground();
splashAnimation.start();
关于android - 如何使用计时器更改图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3395328/