支援所有 Google 字型圖示的物件。
適用於 Google Workspace 外掛程式和 Google Chat 應用程式。
const materialIcon = CardService.newMaterialIcon() .setName('search') .setFill(true) .setWeight(400) .setGrade(0);
方法
| 方法 | 傳回類型 | 簡短說明 |
|---|---|---|
set | Material | 圖示是否會填滿。 |
set | Material | 符號的粗細會受到權重和等級影響。 |
set | Material | 設定圖示名稱。 |
set | Material | 圖示的筆觸粗細。 |
內容詳盡的說明文件
setFill(fill)
圖示是否會填滿。預設值為 false。
如要預覽不同的圖示設定,請前往 Google 字型圖示,然後調整「自訂」下方的設定。
const materialIcon = CardService.newMaterialIcon().setName('search').setFill(true);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
fill | Boolean | 圖示是否已填滿。 |
回攻員
MaterialIcon - 這個物件,用於鏈結。
setGrade(grade)
符號的粗細會受到權重和等級影響。相較於權重調整,成績調整的精細度較高,對符號大小的影響也較小。請從 {-25, 0, 200} 中選擇。如未提供,預設值為 0。如果指定任何其他值,系統會使用預設值。
如要預覽不同的圖示設定,請前往 Google 字型圖示,然後調整「自訂」下方的設定。
const materialIcon = CardService.newMaterialIcon().setName('search').setGrade(200);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
grade | Integer | 圖示的等級。 |
回攻員
MaterialIcon - 這個物件,用於鏈結。
setName(name)
設定圖示名稱。必要欄位。
Google 字型圖示中定義的圖示名稱,例如 check_box。
系統會捨棄所有無效名稱,並替換成空字串,導致圖示無法算繪。
const materialIcon = CardService.newMaterialIcon().setName('search');
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
name | String | 圖示名稱。 |
回攻員
MaterialIcon - 這個物件,用於鏈結。
setWeight(weight)
圖示的筆觸粗細。請從 {100、200、300、400、500、600、700} 中選擇。如未提供,預設值為 400。如果指定任何其他值,系統會使用預設值。
如要預覽不同的圖示設定,請前往 Google 字型圖示,然後調整「自訂」下方的設定。
const materialIcon = CardService.newMaterialIcon().setName('search').setWeight(700);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
weight | Integer | 圖示的筆觸粗細。 |
回攻員
MaterialIcon - 這個物件,用於鏈結。