mPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { // TODO Auto-generated method stub for (int i = 0; i < mDotsLayout.getChildCount(); i++) { if(i == arg0){ mDotsLayout.getChildAt(i).setSelected(true); } else { mDotsLayout.getChildAt(i).setSelected(false); } } if(arg0 == mDotsLayout.getChildCount()-1){//立即进入按钮是否展示 mBtn.setVisibility(View.VISIBLE); } else { mBtn.setVisibility(View.GONE); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub if(isScroll&&(arg0 == viewList.size()-1)){//页面跳转 Intent intent = new Intent(getApplicationContext(),HomeActivity.class); startActivity(intent); finish(); } } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub boolean flag = false; switch (arg0) { case ViewPager.SCROLL_STATE_DRAGGING: flag= false; break; case ViewPager.SCROLL_STATE_SETTLING: flag = true; break; case ViewPager.SCROLL_STATE_IDLE: if (mPager.getCurrentItem() == mPager.getAdapter().getCount() - 1 && !flag) { isScroll = true; }else{ isScroll = false; } flag = true; break; } } });
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。