What is setContentView(R.layout.main)?

后端 未结 6 1309
滥情空心
滥情空心 2020-11-29 08:07

I understand that it has to do with the App layout, but when do I have to use it? I tried to look for a link that explained this method, but I couldn\'t find it. Thank you i

6条回答
  •  野性不改
    2020-11-29 08:23

    Set the activity content from a layout resource. The resource will be inflated, adding all top-level views to the activity.

    • Activity is basically a empty window
    • SetContentView is used to fill the window with the UI provided from layout file incase of setContentView(R.layout.somae_file).
    • Here layoutfile is inflated to view and added to the Activity context(Window).

提交回复
热议问题