检查是用户是否尝试从ViewPager的最后一页滑出,然后启动一个新的并终止当前活动

时间:2014-01-22 19:46:18

标签: android android-viewpager android-fragmentactivity

我的Activity扩展了FragmentActivity

public class SlideScreen extends FragmentActivity {


    SectionsPagerAdapter mSectionsPagerAdapter;


    ViewPager mViewPager;
 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_screen);


        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());


        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mSectionsPagerAdapter);



        OnPageChangeListener mListener = new OnPageChangeListener() {

            @Override
            public void onPageSelected(int arg0) {

                Log.i("Doing something here", "onPageSelected : "+arg0);
            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {


                Log.i("My App Logs", "onPageScrolled : "+arg0+"  "+arg1+" "+arg2);
            }

            @Override
            public void onPageScrollStateChanged(int arg0) {
                Log.i("My App Logs", "onPageScrollStateChanged : "+arg0);
            }
        };
        mViewPager.setOnPageChangeListener(mListener);

    }
...

...
}

我想知道用户何时尝试滑出最后一页(共5页),我无法应用OnSwipeOutListener

OnPageChangeListeneronPageSelected44th轻扫时,5th无法帮助我4 Activity以及

我想在最后一页的滑动中开始新的{{1}}。

0 个答案:

没有答案