簡體   English   中英

活動和包含片段的生命周期

[英]Lifecycle of Activity and containing Fragment

假設我有一個Activity ,通過它的XML布局嵌入了一個Fragment例如:

<fragment
    android:id="@+id/detaillist"
    android:name="com.example.DetailListFragment"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1"
    tools:layout="@android:layout/list_content" />

Fragment我依賴於ActivityonCreate方法中發生的事情。 我可以確定在哪個Fragment生命周期回調中完成ActivityonCreate

@Override
public void onActivityCreated(Bundle savedInstanceState) {

}

Fragment此功能將幫助您了解Activity的onCreate已完成。 希望這會有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM