AlertDialog 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| AlertDialog(Context) |
建立一個使用預設警報對話主題的警報對話框。 |
| AlertDialog(Context, Int32) |
建立一個使用明確主題資源的警示對話框。 |
| AlertDialog(IntPtr, JniHandleOwnership) |
初始化現有 Java 原生介面物件的受管理表示。 |
| AlertDialog(Context, Boolean, IDialogInterfaceOnCancelListener) |
建立一個使用預設警報對話主題及自訂取消聆聽器的警報對話框。 |
| AlertDialog(Context, Boolean, EventHandler) |
AlertDialog(Context)
建立一個使用預設警報對話主題的警報對話框。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")]
protected AlertDialog(Android.Content.Context? context);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")>]
new Android.App.AlertDialog : Android.Content.Context -> Android.App.AlertDialog
參數
- context
- Context
父語境
- 屬性
備註
建立一個使用預設警報對話主題的警報對話框。 預設的警示對話主題由 R.attr.alertDialogTheme 定義,置於父上下文的主題中。
另請參閱:
Android 參考資料。android.app.AlertDialog.AlertDialog
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
AlertDialog(Context, Int32)
建立一個使用明確主題資源的警示對話框。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;I)V", "")]
protected AlertDialog(Android.Content.Context? context, int themeResId);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;I)V", "")>]
new Android.App.AlertDialog : Android.Content.Context * int -> Android.App.AlertDialog
參數
- context
- Context
父語境
- themeResId
- Int32
主題的資源 ID,用來膨脹此對話,或 0 使用父 context程式預設的警示對話主題
- 屬性
備註
建立一個使用明確主題資源的警示對話框。 指定的主題資源(themeResId)會套用在父上下文的主題之上。 它可以被指定為包含完整主題(如 R.style.Theme_Material_Dialog)的樣式資源,以替換父上下文主題中的所有屬性,包括原色與強調色。 為了保留原色與強調色等屬性,themeResId可指定為覆蓋主題,如R.style.ThemeOverlay_Material_Dialog。 這只會覆蓋將警示視窗設計為對話框所需的視窗屬性。 或者,themeResID 也可以指定為 0,以使用父上下文中 R.attr.alertDialogTheme 的解析值。
另請參閱:
Android 參考資料。android.app.AlertDialog.AlertDialog
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
AlertDialog(IntPtr, JniHandleOwnership)
初始化現有 Java 原生介面物件的受管理表示。
protected AlertDialog(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.App.AlertDialog : nativeint * Android.Runtime.JniHandleOwnership -> Android.App.AlertDialog
參數
- javaReference
-
IntPtr
nativeint
Java 原生介面物件參考。
- transfer
- JniHandleOwnership
所有權轉移應用於 Java 原生介面物件參考。
備註
當 .NET 為 Android 綁定執行時建立一個受管理的 Java 物件時,會呼叫這個建構子。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
AlertDialog(Context, Boolean, IDialogInterfaceOnCancelListener)
建立一個使用預設警報對話主題及自訂取消聆聽器的警報對話框。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;ZLandroid/content/DialogInterface$OnCancelListener;)V", "")]
protected AlertDialog(Android.Content.Context? context, bool cancelable, Android.Content.IDialogInterfaceOnCancelListener? cancelListener);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;ZLandroid/content/DialogInterface$OnCancelListener;)V", "")>]
new Android.App.AlertDialog : Android.Content.Context * bool * Android.Content.IDialogInterfaceOnCancelListener -> Android.App.AlertDialog
參數
- context
- Context
情境:父語境
- cancelable
- Boolean
boolean
- cancelListener
- IDialogInterfaceOnCancelListener
DialogInterface.OnCancelListener
- 屬性
備註
建立一個使用預設警報對話主題及自訂取消聆聽器的警報對話框。 這在功能上與:預設的警報對話主題由 R.attr.alertDialogTheme 在父上下文的主題中定義。
另請參閱:
Android 參考資料。android.app.AlertDialog.AlertDialog
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
AlertDialog(Context, Boolean, EventHandler)
protected AlertDialog(Android.Content.Context context, bool cancelable, EventHandler cancelHandler);
new Android.App.AlertDialog : Android.Content.Context * bool * EventHandler -> Android.App.AlertDialog
參數
- context
- Context
- cancelable
- Boolean
- cancelHandler
- EventHandler
備註
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。