Android Fragment - move from one View to another?

后端 未结 6 525
有刺的猬
有刺的猬 2020-12-16 18:04

Can i first add a Fragment to a View, then \"detach\" it, and then \"re-attach\" it to another View?

In code, i want to:

fragOne one = new fragOne();         


        
6条回答
  •  生来不讨喜
    2020-12-16 18:47

    I have run into that problem as well. Sometimes moving fragments works, sometimes you have to create a new instance. It seems that moving fragments does not work, if the fragment keeps being in the "isRemoving" state. Being removed also seems to be prevented by having a fragment in the backstack.

提交回复
热议问题