1
我将FrameLayout作为根布局进行布局。定期更改背景图像ImageView
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/background_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/init_image"
android:scaleType="centerCrop">
</ImageView>
......
......
</FrameLayout>
我需要定期更改无限循环中的一些图像(某些条件),所以像幻灯片一样。
我试图使用处理程序,但当我改变我得到OutOfMemory错误。
我也试过ImageSwitcher,但它似乎不能正常工作。
请给出一个例子或建议如何正确遵循Android的所有设计模式,thx。
您可以使用定时器在经过一定时间后更改图像视图的可绘制 – Phil3992 2015-04-06 13:36:38
使用视图寻呼机以所描述的时间间隔滑动图像 – Anuj 2015-04-06 13:36:50
尝试使用AsyncTask加载新图像并在改变时播放一些动画它被加载后的图像。在时间间隔内执行Handler中的asynctask。 – 2015-04-06 13:37:53