Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 fragmentTransaction.remove 或将片段容器视图可见性更改为 GONE - setVisibility(GONE); 删除片段(不需要动画时)的更好做法是什么?
删除片段将导致整个片段被销毁(将调用 onStop 和 onDestroy)。
将可见性设置为 GONE 只会对用户隐藏视图。片段实例仍将存在并贯穿生命周期事件。