Most visited

Recently visited

ListPreferenceDialogFragment

public class ListPreferenceDialogFragment
extends PreferenceDialogFragment

java.lang.Object
    android.app.Fragment
      android.app.DialogFragment
        android.support.v14.preference.PreferenceDialogFragment
          android.support.v14.preference.ListPreferenceDialogFragment


摘要(Summary)

Inherited XML attributes

From class android.app.Fragment

Inherited constants

From class android.support.v14.preference.PreferenceDialogFragment
From class android.app.DialogFragment
From interface android.content.ComponentCallbacks2

Public constructors

ListPreferenceDialogFragment()

公共方法(Public methods)

static ListPreferenceDialogFragment newInstance(String key)
void onCreate(Bundle savedInstanceState)

被调用来做一个片段的初始创建。

void onDialogClosed(boolean positiveResult)
void onSaveInstanceState(Bundle outState)

打电话询问片段以保存其当前的动态状态,以便稍后可以在重新启动其进程的新实例时重新构建它。

Protected methods

void onPrepareDialogBuilder(AlertDialog.Builder builder)

准备在单击首选项时显示对话框构建器。

继承方法(Inherited methods)

From class android.support.v14.preference.PreferenceDialogFragment
From class android.app.DialogFragment
From class android.app.Fragment
From class java.lang.Object
From interface android.content.DialogInterface.OnClickListener
From interface android.content.DialogInterface.OnCancelListener
From interface android.content.DialogInterface.OnDismissListener
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener
From interface android.content.ComponentCallbacks

Public constructors

ListPreferenceDialogFragment

ListPreferenceDialogFragment ()

公共方法(Public methods)

newInstance

ListPreferenceDialogFragment newInstance (String key)

参数(Parameters)
key String
返回(Returns)
ListPreferenceDialogFragment

onCreate

void onCreate (Bundle savedInstanceState)

被调用来做一个片段的初始创建。 这是在onAttach(Activity)之后和onAttach(Activity)之前onCreateView(LayoutInflater, ViewGroup, Bundle) ,但如果片段实例在活动重新创建期间保留(请参阅setRetainInstance(boolean) ),则不会调用它。

请注意,这可以在片段的活动仍处于创建过程中时调用。 因此,您不能依赖于此时正在初始化活动的内容视图层次结构。 如果您想在创建活动本身后进行工作,请参阅onActivityCreated(Bundle)

如果您的应用targetSdkVersion为23或更低,则在onCreate返回后,将恢复从savedInstanceState恢复的子片段。 当瞄准N或更高版本并且在N或更新的平台版本上运行时,它们被恢复Fragment.onCreate

参数(Parameters)
savedInstanceState Bundle: If the fragment is being re-created from a previous saved state, this is the state.

onDialogClosed

void onDialogClosed (boolean positiveResult)

参数(Parameters)
positiveResult boolean

onSaveInstanceState

void onSaveInstanceState (Bundle outState)

打电话询问片段以保存其当前的动态状态,以便稍后可以在重新启动其进程的新实例时重新构建它。 如果片段的新实例后需要创建,您的包放在这里的数据将提供给包可onCreate(Bundle)onCreateView(LayoutInflater, ViewGroup, Bundle) ,并onActivityCreated(Bundle)

这对应于Activity.onSaveInstanceState(Bundle) ,这里的大部分讨论也适用于此。 但请注意: 此方法可能在onDestroy()之前的任何时间被调用 有很多情况下,碎片可能大部分被拆除(例如,当放置在背堆栈上而没有UI显示时),但是它的状态不会被保存直到其拥有的活动实际上需要保存其状态。

参数(Parameters)
outState Bundle: Bundle in which to place your saved state.

Protected methods

onPrepareDialogBuilder

void onPrepareDialogBuilder (AlertDialog.Builder builder)

准备在单击首选项时显示对话框构建器。 使用它在对话框上设置自定义属性。

不要 create()show()

参数(Parameters)
builder AlertDialog.Builder

Hooray!