嗨,我怎么再回到我的横幅。如果获得最后一个横幅并再次回到早期横幅。谢谢你们之前
这个例子是我的代码:
//Banner Variable
private int currentPage = -1;
private static final int NUM_PAGES = 0;
final Handler handler = new Handler();
final Runnable update = new Runnable() {
@Override
public void run() {
if (currentPage == NUM_PAGES - 1) {
currentPage = 0;
}
vpbanner.setCurrentItem(currentPage++, true);
}
};
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
handler.post(update);
}
}, 1000, 2000);
希望下面的代码解决你的问题: -
vpbanner.setCurrentItem(currentPage == 0 ? 4 : 0, true);