Fragments within Fragments

前端 未结 6 775
名媛妹妹
名媛妹妹 2020-11-22 09:47

I\'m wondering if this is actually a bug in the Android API:

I have a setup like so:

┌----┬---------┐
|    |         |
|  1 |    2    |
|    |┌------         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 10:31

    I have an application that I am developing that is laid out similar with Tabs in the Action Bar that launches fragments, some of these Fragments have multiple embedded Fragments within them.

    I was getting the same error when I tried to run the application. It seems like if you instantiate the Fragments within the xml layout after a tab was unselected and then reselected I would get the inflator error.

    I solved this replacing all the fragments in xml with Linearlayouts and then useing a Fragment manager/ fragment transaction to instantiate the fragments everything seems to working correctly at least on a test level right now.

    I hope this helps you out.

提交回复
热议问题