Android Fragments: When to use hide/show or add/remove/replace?

后端 未结 3 1817
粉色の甜心
粉色の甜心 2020-11-29 16:07

Suppose I wish to replace the current fragment in some container view with another. Is it better to use replace...

    FragmentTransaction ft = getSupportFra         


        
3条回答
  •  Happy的楠姐
    2020-11-29 16:50

    You basically answered yourself. If you want to replace (so old fragment is no longer needed) use replace() if you want to temporary hide it then do hide().

提交回复
热议问题