Class IconImage
图标图片
预定义图标、Material Design 图标,或具有可自定义剪裁样式的网址图标。
详细文档
setAltText(altText)
设置网址的替代文本,用于无障碍功能。
参数
名称 | 类型 | 说明 |
altText | String | 替代文本。 |
返回
IconImage
- 此对象,用于链式调用。
setIcon(icon)
如果未设置网址,则设置预定义的图标。默认值为 NONE。
参数
返回
IconImage
- 此对象,用于链式调用。
setIconUrl(url)
如果未设置图标,则设置图标的网址。
参数
名称 | 类型 | 说明 |
url | String | 要用作图标的托管图片的网址。 |
返回
IconImage
- 此对象,用于链式调用。
setImageCropType(imageCropType)
设置图片的剪裁样式。您可以为图标使用的剪裁类型选项包括 SQUARE
和 CIRCLE
。默认值为 SQUARE
。
参数
返回
IconImage
- 此对象,用于链式调用。
setMaterialIcon(icon)
设置 Material Design 图标。
const iconImage = CardService.newIconImage().setMaterialIcon(
CardService.newMaterialIcon().setName('search'),
);
参数
返回
IconImage
- 此对象,用于链式调用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-04。
[null,null,["最后更新时间 (UTC):2024-12-04。"],[[["`IconImage` allows you to display a predefined or custom icon using a URL."],["You can customize the icon's appearance with a specific crop style (SQUARE or CIRCLE)."],["Alternative text can be set for accessibility purposes using `setAltText()`."],["The `setIcon()` and `setIconUrl()` methods allow you to specify the icon source, either a predefined icon or a URL."],["All methods return the `IconImage` object, enabling method chaining for streamlined configuration."]]],["The `IconImage` object allows setting an icon using predefined options, a material design icon, or a URL. Key actions include: setting alternative text for accessibility (`setAltText`), choosing a predefined icon (`setIcon`), specifying an icon URL (`setIconUrl`), defining the image crop style (`setImageCropType`), and selecting a material design icon (`setMaterialIcon`). Each method returns the `IconImage` object for chaining additional actions.\n"]]