//不带导航原点
adViewpagerUtil = new AdViewpagerUtil(this, viewpager, urls);
adViewpagerUtil.initVps();
//带导航原点
adViewpagerUtil = new AdViewpagerUtil(this, viewpager, lydots, 8, 4, urls);
adViewpagerUtil.initVps();
adViewpagerUtil.setOnAdItemClickListener(new AdViewpagerUtil.OnAdItemClickListener() {
@Override
public void onItemClick(View v, int flag) {
Toast.makeText(MainActivity.this, "flag:" + flag, Toast.LENGTH_SHORT).show();
}
});
adViewpagerUtil.setOnAdPageChangeListener(new AdViewpagerUtil.OnAdPageChangeListener() {
@Override
public void onPageScrollStateChanged(int arg0) {
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageSelected(int arg0) {
if(arg0 == 0)
arg0 = 1;
if(arg0 == urls.length + 1)
{
arg0 = urls.length;
}
tvtxt.setText("第" + arg0 + "张");
}
});