Is there any alternative to nested Fragments?

后端 未结 5 1942
醉酒成梦
醉酒成梦 2021-01-12 17:42

I\'ve read around that nesting Fragments should be avoided (eg. here), but I can\'t see how to do the following:

I\'m working on a tab application (android:min

5条回答
  •  执念已碎
    2021-01-12 18:02

    Good news!!!!! android support library version 11 is already support nested fragment. Support Package, revision 11 (November 2012)

    Changes for v4 support library:
        User Interface
            Added support for nested Fragment classes.

    How to implement nested fragment, from android developer

    You can now embed fragments inside fragments. This is useful for a variety of situations in which you want to place dynamic and re-usable UI components into a UI component that is itself dynamic and re-usable. For example, if you use ViewPager to create fragments that swipe left and right and consume a majority of the screen space, you can now insert fragments into each fragment page.

    There are some key here: getChildFragmentManager() and getParentFragment()

提交回复
热议问题