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 上执行的事件操作。
参数
返回
Widget - 用于链式调用的对象。
setId(id)
设置用于标识要发生变异的 widget 的唯一 ID。只有在插件中支持 widget 突变。
参数
| 名称 | 类型 | 说明 |
id | String | 微件的 ID,长度限制为 64 个字符,格式为 `[a-zA-Z0-9-]+`。 |
返回
Widget - 此对象,用于链式调用。
setVisibility(visibility)
设置 widget 的可见性。默认值为 `VISIBLE`。
参数
返回
Widget - 用于链式调用的对象。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-04-13。
[null,null,["最后更新时间 (UTC):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"]]