采用了Android库作为自动幻灯片 [英] Using the Android Gallery as an automated slideshow
本文介绍了采用了Android库作为自动幻灯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想创建一个启动画面为一个应用程序,并拥有一个画廊旋转多个图像上的计时器。谁能告诉我如何我可以用一个计时器在画廊动画形象?
Hi I want to create a splashscreen for an app, and have a gallery rotate several images on a timer. Can anyone show me how I could use a timer to animate the images in a Gallery?
推荐答案
一个简单的解决办法是
private int PicPosition;
private Handler handler = new Handler();
... ... ......
... ... ...
private Runnable runnable = new Runnable() {
public void run() {
myslideshow();
handler.postDelayed(this, 1000);\\execute every second.
}
};
private void myslideshow()
{
PicPosition = gallery.getSelectedItemPosition() +1;
if (PicPosition >= Pictures.size())
PicPosition = gallery.getSelectedItemPosition(); //stop
else
gallery.setSelection(PicPosition);//move to the next gallery element.
}
这篇关于采用了Android库作为自动幻灯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文