Error inflating class fragment - duplicate id/illegalargumentexception?

后端 未结 7 919
梦毁少年i
梦毁少年i 2020-12-02 17:05

I\'m trying make an app that I\'m building take a search term from the main activity, return results, and then have the results be clickable such that a detail could be view

7条回答
  •  庸人自扰
    2020-12-02 18:02

    If you were reading the other answers here feeling that they seemed correct, look here https://stackoverflow.com/a/19815266/1139784 because it references the documentation explaining how this is not supported (at least in my case, it is hard to tell from this question whether the layout fragment nesting is happening)

    Note: You cannot inflate a layout into a fragment when that layout includes a .
    Nested fragments are only supported when added to a fragment dynamically.
    

    More data here Best practice for nested fragments in Android 4.0, 4.1 (<4.2) without using the support library

    Edit: Also, if you're considering using nested fragments and don't need the lifecycle management, you can create a custom view group (like extending LinearLayout) instead. http://www.vogella.com/tutorials/AndroidCustomViews/article.html

提交回复
热议问题