Most visited

Recently visited

AppCompatDialogFragment

public class AppCompatDialogFragment
extends DialogFragment

java.lang.Object
   ↳ android.support.v4.app.Fragment
     ↳ android.support.v4.app.DialogFragment
       ↳ android.support.v7.app.AppCompatDialogFragment
Known Direct Subclasses


一个特殊版本的 DialogFragment ,它使用 AppCompatDialog代替平台样式的对话框。

也可以看看:

Summary

Inherited constants

From class android.support.v4.app.DialogFragment

Public constructors

AppCompatDialogFragment()

Public methods

Dialog onCreateDialog(Bundle savedInstanceState)

重写以构建您自己的自定义Dialog容器。

Inherited methods

From class android.support.v4.app.DialogFragment
From class android.support.v4.app.Fragment
From class java.lang.Object
From interface android.content.DialogInterface.OnCancelListener
From interface android.content.DialogInterface.OnDismissListener
From interface android.content.ComponentCallbacks
From interface android.view.View.OnCreateContextMenuListener

Public constructors

AppCompatDialogFragment

AppCompatDialogFragment ()

Public methods

onCreateDialog

Dialog onCreateDialog (Bundle savedInstanceState)

重写以构建您自己的自定义Dialog容器。 这通常用于显示AlertDialog而不是通用的Dialog; 当这样做时,由于AlertDialog处理自己的内容, onCreateView(LayoutInflater, ViewGroup, Bundle)不需要执行onCreateView(LayoutInflater, ViewGroup, Bundle)

该方法将在onCreate(Bundle)之后和onCreateView(LayoutInflater, ViewGroup, Bundle)之前onCreateView(LayoutInflater, ViewGroup, Bundle) 默认实现只是实例化并返回一个Dialog类。

注意:DialogFragment拥有Dialog.setOnCancelListenerDialog.setOnDismissListener回调。 你不能自己设置它们。 要了解这些事件,请覆盖onCancel(DialogInterface)onDismiss(DialogInterface)

Parameters
savedInstanceState Bundle: The last saved instance state of the Fragment, or null if this is a freshly created Fragment.
Returns
Dialog Return a new Dialog instance to be displayed by the Fragment.

Hooray!