用于在主机应用中显示链接预览卡片和智能条状标签的卡片操作。如需了解详情,请参阅预览使用智能条状标签的链接。
const decoratedText = CardService.newDecoratedText() .setTopLabel('Hello') .setText('Hi!'); const cardSection = CardService.newCardSection() .addWidget(decoratedText); const card = CardService.newCardBuilder() .addSection(cardSection) .build(); const linkPreview = CardService.newLinkPreview() .setPreviewCard(card) .setTitle('Smart chip title');
方法
方法 | 返回类型 | 简介 |
---|---|---|
printJson() | String | 输出此对象的 JSON 表示法。 |
setLinkPreviewTitle(title) | LinkPreview | 设置在预览卡片上方的链接预览中显示的标题。 |
setPreviewCard(previewCard) | LinkPreview | 设置卡片,以显示第三方或非 Google 服务的链接的相关信息。 |
setTitle(title) | LinkPreview | 设置在智能条状标签中显示的链接预览标题。 |
详细文档
printJson()
输出此对象的 JSON 表示法。这仅用于调试。
弃踢回攻
String
setLinkPreviewTitle(title)
设置在预览卡片上方的链接预览中显示的标题。如果未设置此政策,链接预览会显示 PreviewCard
的标头。
const linkPreview = CardService.newLinkPreview() .setLinkPreviewTitle("Link preview title");
参数
名称 | 类型 | 说明 |
---|---|---|
title | String | 链接预览的标题。 |
弃踢回攻
LinkPreview
- 此对象,用于链接。
setPreviewCard(previewCard)
设置卡片,以显示第三方或非 Google 服务的链接的相关信息。
const decoratedText = CardService.newDecoratedText() .setTopLabel('Hello') .setText('Hi!'); const cardSection = CardService.newCardSection() .addWidget(decoratedText); const card = CardService.newCardBuilder() .addSection(cardSection) .build(); const linkPreview = CardService.newLinkPreview() .setPreviewCard(card) .setTitle('Smart chip title');
参数
名称 | 类型 | 说明 |
---|---|---|
previewCard | Card | 预览卡片。 |
弃踢回攻
LinkPreview
- 此对象,用于链接。
setTitle(title)
设置在智能条状标签中显示的链接预览标题。如果未设置,智能条状标签会显示 PreviewCard
的标头。
const linkPreview = CardService.newLinkPreview() .setTitle('Smart chip title');
参数
名称 | 类型 | 说明 |
---|---|---|
title | String | 智能条状标签的标题。 |
弃踢回攻
LinkPreview
- 此对象,用于链接。