如何在视图寻呼机超过新页面的阈值时收听?

时间:2018-06-02 05:09:47

标签: android android-viewpager

在视图寻呼机上滑动时。有一点,当你放手时,它会转到另一页而不是原来的页面 - 中间点是AKA。

ViewPager.OnPageChangeListener.onPageSelected(int position)仅在选择后被调用。

我希望在用户超过阈值时收到通知。我应该怎么做呢?

1 个答案:

答案 0 :(得分:0)

viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            //This method will be invoked when the current page is scrolled, either as part of a
            // programmatically initiated smooth scroll or a user initiated touch scroll.
        }

        @Override
        public void onPageSelected(int position) {
            //This method will be invoked when a new page becomes selected.
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            //Called when the scroll state changes.
        }
    });

有关详细信息,请参阅ViewPager.addOnPageChangeListener