由于我是用vieaPager包裹的fragment,所以直接让你的adapter继承:
class CheckListPageAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm,BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT)
baseLazyFragment:
abstract class BaseLazyFragment : BaseFragment() {
private var isLoaded = false
final override fun onResume() {
super.onResume()
if (isLoaded){
onLazyResume()
}
if (!isLoaded) {
initView()
initData()
isLoaded = true
}
}
/**
* 子类的所有resume操作在此方法中进行
*/
open fun onLazyResume() {
}
}