更新时间:2023-01-09 20:46:26
切换super.onCreate第一,然后的setContentView。
Switch super.onCreate first, then setContentView.
这是因为super.onCreate调用框架的Activity.onCreate分配膨胀任何布局所需要的资源。因此,必须充气任何布局,XML /编程之前被调用。
This is because super.onCreate calls the framework's Activity.onCreate to allocate the resources needed to inflate any layouts. Hence , must be called before inflating any layouts, xml/programmatic.