我不知道我什么时候必须使用的onCreate
或 onCreateView
。我觉得的onCreate
的活动和 onCreateView
的片段。但我不知道。我可以使用的onCreate
的片段?我希望有人能帮帮我!
I don't know when I must use onCreate
or onCreateView
. I think onCreate
for Activity and onCreateView
for Fragment. But I am not sure. Can I use onCreate
in Fragment? I hope somebody can help me!
推荐答案
的onCreate 的呼吁片段的初始创建。你在这里做你的非图形化的初始化。它完成之前的布局是膨胀和片段可见。
onCreate is called on initial creation of the fragment. You do your non graphical initializations here. It finishes even before the layout is inflated and the fragment is visible.
onCreateView 被称为膨胀,即图形初始化通常发生在这里的片段布局。它总是有时在的onCreate 方式后调用。
onCreateView is called to inflate the layout of the fragment i.e graphical initialization usually takes place here. It is always called sometimes after the onCreate method.
相关推荐
最新文章