Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Class ButtonSet
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
ButtonSet
保存一組以資料列顯示的 Button 物件。
適用於 Google Workspace 外掛程式和 Google Chat 應用程式。
const textButton = CardService.newTextButton();
// Finish building the text button...
const imageButton = CardService.newImageButton();
// Finish building the image button...
const buttonSet =
CardService.newButtonSet().addButton(textButton).addButton(imageButton);
內容詳盡的說明文件
addEventAction(eventAction)
新增可在小工具上執行的事件動作。
參數
回攻員
Widget - 物件,用於鏈結。
setId(id)
設定指派的專屬 ID,用於識別要變動的小工具。外掛程式僅支援小工具變動。
參數
| 名稱 | 類型 | 說明 |
id | String | 小工具的 ID,長度上限為 64 個字元,格式為 `[a-zA-Z0-9-]+`。 |
回攻員
Widget - 這個物件,用於鏈結。
setVisibility(visibility)
設定小工具的顯示狀態。預設值為 `VISIBLE`。
參數
回攻員
Widget - 物件,用於鏈結。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-04-13 (世界標準時間)。
[null,null,["上次更新時間:2026-04-13 (世界標準時間)。"],[],["The `ButtonSet` object holds and displays a row of `Button` objects. You can create a `ButtonSet` using `CardService.newButtonSet()`. To add buttons, use the `addButton(button)` method, passing in a `Button` object. This method can be chained to add multiple buttons sequentially. `addButton` returns the `ButtonSet` object itself. This functionality is available for Google Workspace add-ons and Google Chat apps.\n"]]