1. 程式人生 > >ViewPager過時方法的替代

ViewPager過時方法的替代

過時方法更改技巧:檢視原始碼,看原始碼的提示資訊

例如

   /**
     * Set a listener that will be invoked whenever the page changes or is incrementally
     * scrolled. See {@link OnPageChangeListener}.
     *
     * @param listener Listener to set
     *
     * @deprecated Use {@link #addOnPageChangeListener(OnPageChangeListener)}
     * and {@link #removeOnPageChangeListener(OnPageChangeListener)} instead
. */ @Deprecated public void setOnPageChangeListener(OnPageChangeListener listener) { mOnPageChangeListener = listener; }


 mViewPager.addOnPageChangeListener(new MyOnPageChangeListener());
詳細的檢視