本文在前面Fragment系列文章的基础上,重在想要从源码和实践运用的角度,去学习、分析、总结Fragment一些新技术函数和组件。
1.setUserVisibleHint与setMaxLifecycle
1.1 废弃原因
我们先看一下最新的setUserVisibleHint方法的注释
/**
* Set a hint to the system about whether this fragment's UI is currently visible
* to the user. This hint defaults to true and is persistent across fragment instance
* state save and restore.
*
* <p>An app may set this to false to indicate that the fragment's UI is
* scrolled out of visibility or is otherwise not directly visible to the user.
* This may be used by the system to prioritize operations s