什么是分离一个片段和取出的区别? [英] What's the difference between detaching a Fragment and removing it?

查看:101
本文介绍了什么是分离一个片段和取出的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android的文档的<一个href="http://developer.android.com/reference/android/app/FragmentTransaction.html">FragmentTransaction我注意到两个非常相似的方法:分离删除。那边的说明似乎并没有提供有关何时使用每一个很大的启示,并从我可以告诉他们似乎是相同的。

In the Android docs for a FragmentTransaction I noticed two very similar methods: detach and remove. The descriptions over there don't seem to provide much insight about when to use each, and from what I can tell they appear to be the same.

那么什么是这两种方法之间的差异

So: what are the differences between these two methods?

推荐答案

的分离方法删除用户界面的片段,但它的状态是由段管理维护。这意味着您可以通过调用附加方法,用修改ViewHierarchy

The detach method removes the fragment from the UI, but its state is maintained by the Fragment Manager. This means you can reuse this fragment by calling the attach method, with a modified ViewHierarchy

删除意味着片段实例不能被重新装上。你将不得不重新添加到该片段的交易。

Remove means the fragment instance cannot be re-attached. You will have to add it again to the fragment transaction.

这篇关于什么是分离一个片段和取出的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆