How to setContentView in a fragment?

前端 未结 5 1824
说谎
说谎 2020-11-29 05:53

Now I\'ve got this fragment which i want to use setContentView with but so far i cant find how. You can see my case in the code below, im not trying to inflate a layout, im

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 06:24

    Also it's not safe to call getActivity() from onCreateView(). Make sure you call it in or after onActivityCreated(), as at this point your Fragment is fully associated with the Activity. Check Fragment's lifecycle.

    Fragments

提交回复
热议问题