答案 0 :(得分:1)
使用Timer Class自动增加viewPager当前选择
final int seconds =2;
final int delayTime =0;
activity.runOnUiThread(new Runnable() {
public void run() {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
int selection=viewPager.getCurrentItem();
viewPager.setCurrentItem(selection++);
}
}, delayTime, seconds * 1000);
}
});