哪里的onCreate和onCreateView之间的diferent [英] where is the diferent between onCreate and onCreateView

查看:118
本文介绍了哪里的onCreate和onCreateView之间的diferent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我什么时候必须使用的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.

这篇关于哪里的onCreate和onCreateView之间的diferent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆