語言

Notification.Builder.AddAction 方法

定義

多載

名稱 Description
AddAction(Notification+Action)

在此通知中新增一個動作。

AddAction(Int32, ICharSequence, PendingIntent)
已淘汰.

此方法在 API 等級 23 中被棄用。

AddAction(Int32, String, PendingIntent)
已淘汰.

此方法在 API 等級 23 中被棄用。

AddAction(Notification+Action)

在此通知中新增一個動作。

[Android.Runtime.Register("addAction", "(Landroid/app/Notification$Action;)Landroid/app/Notification$Builder;", "GetAddAction_Landroid_app_Notification_Action_Handler")]
public virtual Android.App.Notification.Builder AddAction(Android.App.Notification.Action? action);
[<Android.Runtime.Register("addAction", "(Landroid/app/Notification$Action;)Landroid/app/Notification$Builder;", "GetAddAction_Landroid_app_Notification_Action_Handler")>]
abstract member AddAction : Android.App.Notification.Action -> Android.App.Notification.Builder
override this.AddAction : Android.App.Notification.Action -> Android.App.Notification.Builder

參數

action
Notification.Action

Notification.Action:新增的動作

傳回

這個 Android.App.Notification.Builder 實例,允許通話串接。

屬性

備註

在此通知中新增一個動作。 系統通常會將動作顯示為通知內容旁邊的按鈕。 動作可以包含圖示(32dp 正方形,與 Holo Dark 動作列視覺風格相符)以及文字標籤。 非上下文動作可能有空的 PendingIntent,此時系統介面可能會顯示該動作為停用。 情境動作需要非空圖示及 PendingIntent。 擴充後的通知最多可顯示三個動作,依新增順序從左到右排列。 不過,當通知被收合時,動作將不會顯示,因此請確保使用者能以其他方式存取任何重要功能(例如,在 Notification.contentIntent 指向的活動中)。

Android 參考資料。android.app.Notification.Builder.addAction

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

AddAction(Int32, ICharSequence, PendingIntent)

警告

deprecated

此方法在 API 等級 23 中被棄用。

[Android.Runtime.Register("addAction", "(ILjava/lang/CharSequence;Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;", "GetAddAction_ILjava_lang_CharSequence_Landroid_app_PendingIntent_Handler")]
[System.Obsolete("deprecated")]
public virtual Android.App.Notification.Builder? AddAction(int icon, Java.Lang.ICharSequence? title, Android.App.PendingIntent? intent);
[<Android.Runtime.Register("addAction", "(ILjava/lang/CharSequence;Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;", "GetAddAction_ILjava_lang_CharSequence_Landroid_app_PendingIntent_Handler")>]
[<System.Obsolete("deprecated")>]
abstract member AddAction : int * Java.Lang.ICharSequence * Android.App.PendingIntent -> Android.App.Notification.Builder
override this.AddAction : int * Java.Lang.ICharSequence * Android.App.PendingIntent -> Android.App.Notification.Builder

參數

icon
Int32

int:代表動作的可繪製物件的資源 ID

title
ICharSequence

CharSequence:描述動作的文字

intent
PendingIntent

待定意圖:待執行行動時被觸發的待定意圖

傳回

這個 Android.App.Notification.Builder 實例,允許通話串接。

屬性

備註

此方法在 API 等級 23 中被棄用。 改用 addAction(Action) 來處理。

在此通知中新增一個動作。 系統通常會將動作顯示為通知內容旁邊的按鈕。 動作可以包含圖示(32dp 正方形,與 Holo Dark 動作列視覺風格相符)以及文字標籤。 非上下文動作可能有空的 PendingIntent,此時系統介面可能會顯示該動作為停用。 情境動作需要非空圖示及 PendingIntent。 擴充後的通知最多可顯示三個動作,依新增順序從左到右排列。 不過,當通知被收合時,動作將不會顯示,因此請確保使用者能以其他方式存取任何重要功能(例如,在 Notification.contentIntent 指向的活動中)。 Android Build.VERSION_CODES。S,針對 API 層級Build.VERSION_CODES的應用程式。S 級或更高級的用戶在處理廣播接收器或服務時,無法啟動通知動作點擊的活動。 在這些情況下,要啟動活動,請為該活動本身提供 PendingIntent。 自 Android Build.VERSION_CODES 以來。N,部分動作按鈕不顯示圖示。 圖示仍可供通知聆聽者使用,他們可能會在其他情境中顯示,例如在穿戴裝置上。

Android 參考資料。android.app.Notification.Builder.addAction

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

AddAction(Int32, String, PendingIntent)

警告

deprecated

此方法在 API 等級 23 中被棄用。

[System.Obsolete("deprecated")]
public Android.App.Notification.Builder? AddAction(int icon, string? title, Android.App.PendingIntent? intent);
[<System.Obsolete("deprecated")>]
member this.AddAction : int * string * Android.App.PendingIntent -> Android.App.Notification.Builder

參數

icon
Int32

int:代表動作的可繪製物件的資源 ID

title
String

CharSequence:描述動作的文字

intent
PendingIntent

待定意圖:待執行行動時被觸發的待定意圖

傳回

這個 Android.App.Notification.Builder 實例,允許通話串接。

屬性

備註

此方法在 API 等級 23 中被棄用。 改用 addAction(Action) 來處理。

在此通知中新增一個動作。 系統通常會將動作顯示為通知內容旁邊的按鈕。 動作可以包含圖示(32dp 正方形,與 Holo Dark 動作列視覺風格相符)以及文字標籤。 非上下文動作可能有空的 PendingIntent,此時系統介面可能會顯示該動作為停用。 情境動作需要非空圖示及 PendingIntent。 擴充後的通知最多可顯示三個動作,依新增順序從左到右排列。 不過,當通知被收合時,動作將不會顯示,因此請確保使用者能以其他方式存取任何重要功能(例如,在 Notification.contentIntent 指向的活動中)。 Android Build.VERSION_CODES。S,針對 API 層級Build.VERSION_CODES的應用程式。S 級或更高級的用戶在處理廣播接收器或服務時,無法啟動通知動作點擊的活動。 在這些情況下,要啟動活動,請為該活動本身提供 PendingIntent。 自 Android Build.VERSION_CODES 以來。N,部分動作按鈕不顯示圖示。 圖示仍可供通知聆聽者使用,他們可能會在其他情境中顯示,例如在穿戴裝置上。

Android 參考資料。android.app.Notification.Builder.addAction

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於