ViewPager過時方法的替代
阿新 • • 發佈:2019-01-31
過時方法更改技巧:檢視原始碼,看原始碼的提示資訊
例如
/**
* 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());
詳細的檢視