0

当我使用此类隐藏选项卡时,哪些事件在 Fragment 类中运行,如下所示:

    public void onTabChanged(String tag) {
    TabInfo newTab = this.mapTabInfo.get(tag);
    if (mLastTab != newTab) {
        FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction();
        if (mLastTab != null) {
            if (mLastTab.fragment != null) {
                **ft.hide(mLastTab.fragment);**
            }
        }
        if (newTab != null) {
            if (newTab.fragment == null) {
                newTab.fragment = Fragment.instantiate(this,
                        newTab.clss.getName(), newTab.args);
                ft.add(R.id.realtabcontent, newTab.fragment, newTab.tag);
            } else {
                **ft.show(newTab.fragment);**
            }
        }

        mLastTab = newTab;
        ft.commit();
        this.getSupportFragmentManager().executePendingTransactions();
    }
}
4

1 回答 1

0

我认为您是在询问Fragment使用隐藏 a 时调用哪些回调方法FragmentTransaction.hide(mLastTab.fragment)

onPause()和回调方法将onStop()在您隐藏时调用Fragment

检查片段生命周期

于 2013-05-25T16:08:23.620 回答