lesson 4 Building a Dynamic UI with Fragments

来源:互联网 发布:yum cache clean 编辑:程序博客网 时间:2024/06/10 03:04

lesson 4 Building a Dynamic UI with Fragments

  1. Note: When you add a fragment to an activity layout by defining the fragment in the layout XML file, you cannot remove the fragment at runtime.

  2. 在处理 Fragment(特别是在运行时添加的 Fragment )时,请谨记以下重要规则:必须在布局中为 Fragment 提供 View 容器,以便保存 Fragment 的布局。

  3. 注意:当你移除或替换 Fragment 并向返回堆栈添加事务时,已移除的 Fragment 会停止(而不是销毁)。如果用户向后导航,还原该 Fragment,它会重新启动。如果你没有向返回堆栈添加事务,那么该 Fragment 在移除或替换时就会被销毁。

0 0
原创粉丝点击