FragmentTransaction.replace() not working

后端 未结 5 1790
星月不相逢
星月不相逢 2021-01-07 22:37

I have a ListFragment displaying a list of items that created by the user. I have a ListView with it\'s id set to \"@android:id/list\" and a

5条回答
  •  独厮守ぢ
    2021-01-07 22:48

    I had a similar problem.

    According to this when you need to add Fragments programmatically, you should add them to an existing ViewGroup.

    So I removed the Fragment from the xml and used FrameLayout component in the replace() method.

    You can also have a look here.

    Hope this helps.

提交回复
热议问题