【发布时间】:2016-05-19 17:31:08
【问题描述】:
问题是,如果我使用 FragmentsTransaction,onDismiss 不会被触发:
FragmentTransaction transaction = getFragmentManager().beginTransaction();
// For a little polish, specify a transition animation
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
// To make it fullscreen, use the 'content' root view as the container
// for the fragment, which is always the root view for the activity
transaction.add(android.R.id.content, _dialogInfo).addToBackStack(null).commit();
但如果我使用 show(),则会调用 onDismiss 事件:
_dialogInfo.show(getFragmentManager(), DialogFragmentInfo.TAG);
onDismiss 在自定义 DialogFragment 中实现,如下所示:
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
}
我不确定为什么会这样,并且我在文档中没有找到任何解释。
【问题讨论】:
标签: java android dialogfragment