在特定代码块中询问DialogFragment

时间:2018-07-14 16:16:56

标签: android dialog android-dialogfragment

我有一个关于DialogFragment的问题,为什么创建并从onCreateDialog方法返回的结果对话框成为onCreateView方法中的容器?谢谢

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    getDialog().setTitle("Register");
    rootView = inflater.inflate(R.layout.fragment_dialog_register,container);
    initUI();
    return rootView;
}

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog= super.onCreateDialog(savedInstanceState);
    dialog.setTitle(getString(R.string.string_register));
    return dialog;
}

源链接:https://github.com/AnilDeshpande/AndroidRestWebServiceIntegration/blob/master/app/src/main/java/com/codetutor/androidrestwebserviceintegration/ui/dialogs/RegisterDialogFragment.java

0 个答案:

没有答案