Class MaterialIcon
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Biểu tượngMaterial
Một đối tượng hỗ trợ tất cả Biểu tượng phông chữ của Google.
Có sẵn cho các tiện ích bổ sung của Google Workspace và ứng dụng Google Chat.
const materialIcon = CardService.newMaterialIcon()
.setName('search')
.setFill(true)
.setWeight(400)
.setGrade(0);
Tài liệu chi tiết
setFill(fill)
Biểu tượng có hiển thị đầy hay không. Giá trị mặc định là false
.
Để xem trước các chế độ cài đặt biểu tượng, hãy chuyển đến phần Biểu tượng phông chữ Google rồi điều chỉnh chế độ cài đặt trong phần Tuỳ chỉnh.
const materialIcon =
CardService.newMaterialIcon().setName('search').setFill(true);
Thông số
Tên | Loại | Mô tả |
fill | Boolean | Liệu biểu tượng có được lấp đầy hay không. |
Cầu thủ trả bóng
MaterialIcon
– Đối tượng này, để tạo chuỗi.
setGrade(grade)
Độ đậm và độ đậm ảnh hưởng đến độ dày của ký hiệu. Việc điều chỉnh điểm sẽ chi tiết hơn việc điều chỉnh trọng số và có tác động nhỏ đến kích thước của ký hiệu. Chọn trong số {-25, 0,
200}. Nếu không có, giá trị mặc định là 0. Nếu bạn chỉ định bất kỳ giá trị nào khác, giá trị mặc định sẽ được sử dụng.
Để xem trước các chế độ cài đặt biểu tượng khác nhau, hãy chuyển đến phần Biểu tượng phông chữ Google rồi điều chỉnh chế độ cài đặt trong phần Tuỳ chỉnh.
const materialIcon =
CardService.newMaterialIcon().setName('search').setGrade(200);
Thông số
Tên | Loại | Mô tả |
grade | Integer | Điểm của biểu tượng. |
Cầu thủ trả bóng
MaterialIcon
– Đối tượng này, để tạo chuỗi.
setName(name)
Đặt tên cho biểu tượng. Bắt buộc.
Tên biểu tượng được xác định trong Biểu tượng phông chữ Google, Ví dụ: check_box
.
Mọi tên không hợp lệ sẽ bị bỏ qua và thay thế bằng một chuỗi trống, dẫn đến việc biểu tượng không hiển thị.
const materialIcon = CardService.newMaterialIcon().setName('search');
Thông số
Tên | Loại | Mô tả |
name | String | Tên của biểu tượng. |
Cầu thủ trả bóng
MaterialIcon
– Đối tượng này, để tạo chuỗi.
setWeight(weight)
Độ đậm của nét vẽ biểu tượng. Chọn trong số {100, 200, 300, 400, 500, 600, 700}. Nếu không có, giá trị mặc định là 400. Nếu bạn chỉ định giá trị nào khác, giá trị mặc định sẽ được sử dụng.
Để xem trước các chế độ cài đặt biểu tượng khác nhau, hãy chuyển đến phần Biểu tượng phông chữ Google rồi điều chỉnh chế độ cài đặt trong phần Tuỳ chỉnh.
const materialIcon =
CardService.newMaterialIcon().setName('search').setWeight(700);
Thông số
Tên | Loại | Mô tả |
weight | Integer | Độ đậm của nét vẽ biểu tượng. |
Cầu thủ trả bóng
MaterialIcon
– Đối tượng này, để tạo chuỗi.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eMaterialIcon\u003c/code\u003e objects allow you to use and customize \u003ca href=\"https://fonts.google.com/icons\"\u003eGoogle Font Icons\u003c/a\u003e within Google Workspace Add-ons and Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize the icon's appearance by setting its fill, grade, name, and weight using methods like \u003ccode\u003esetFill()\u003c/code\u003e, \u003ccode\u003esetGrade()\u003c/code\u003e, \u003ccode\u003esetName()\u003c/code\u003e, and \u003ccode\u003esetWeight()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the \u003ca href=\"https://fonts.google.com/icons\"\u003eGoogle Font Icons\u003c/a\u003e website to preview different icon settings and find valid icon names.\u003c/p\u003e\n"],["\u003cp\u003eWhen setting grade and weight, ensure you use the accepted values or the default values will be applied.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esetName()\u003c/code\u003e method is required and uses the icon name as defined on the Google Font Icons website; using an invalid name will result in the icon not rendering.\u003c/p\u003e\n"]]],[],null,["# Class MaterialIcon\n\nMaterialIcon\n\nAn object that supports all [Google Font Icons](https://fonts.google.com/icons).\n\nAvailable for Google Workspace add-ons and Google Chat apps.\n\n```javascript\nconst materialIcon = CardService.newMaterialIcon()\n .setName('search')\n .setFill(true)\n .setWeight(400)\n .setGrade(0);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|------------------------------------------|-------------------|-----------------------------------------------|\n| [setFill(fill)](#setFill(Boolean)) | [MaterialIcon](#) | Whether the icon renders as filled. |\n| [setGrade(grade)](#setGrade(Integer)) | [MaterialIcon](#) | Weight and grade affect a symbol's thickness. |\n| [setName(name)](#setName(String)) | [MaterialIcon](#) | Sets the name of the icon. |\n| [setWeight(weight)](#setWeight(Integer)) | [MaterialIcon](#) | The stroke weight of the icon. |\n\nDetailed documentation\n----------------------\n\n### `set``Fill(fill)`\n\nWhether the icon renders as filled. Default value is `false`.\n\nTo preview different icon settings, go to [Google\nFont Icons](https://fonts.google.com/icons) and adjust the settings under **Customize**.\n\n```javascript\nconst materialIcon =\n CardService.newMaterialIcon().setName('search').setFill(true);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|-----------|-----------------------------|\n| `fill` | `Boolean` | Whether the icon is filled. |\n\n#### Return\n\n\n[MaterialIcon](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Grade(grade)`\n\nWeight and grade affect a symbol's thickness. Adjustments to grade are more granular than\nadjustments to weight and have a small impact on the size of the symbol. Choose from {-25, 0,\n200}. If absent, default value is 0. If any other value is specified, the default value is\nused.\n\nTo preview different icon settings, go to [Google\nFont Icons](https://fonts.google.com/icons) and adjust the settings under **Customize**.\n\n```javascript\nconst materialIcon =\n CardService.newMaterialIcon().setName('search').setGrade(200);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|-----------|-------------------|\n| `grade` | `Integer` | The icon's grade. |\n\n#### Return\n\n\n[MaterialIcon](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Name(name)`\n\nSets the name of the icon. Required.\n\nThe icon name defined in [Google Font Icon](https://fonts.google.com/icons), For\nexample, `check_box`.\n\nAny invalid names are abandoned and replaced with an empty string and results in the icon\nfailing to render.\n\n```javascript\nconst materialIcon = CardService.newMaterialIcon().setName('search');\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|----------|-----------------------|\n| `name` | `String` | The name of the icon. |\n\n#### Return\n\n\n[MaterialIcon](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Weight(weight)`\n\nThe stroke weight of the icon. Choose from {100, 200, 300, 400, 500, 600, 700}. If absent,\ndefault value is 400. If any other value is specified, the default value is used.\n\nTo preview different icon settings, go to [Google\nFont Icons](https://fonts.google.com/icons) and adjust the settings under **Customize**.\n\n```javascript\nconst materialIcon =\n CardService.newMaterialIcon().setName('search').setWeight(700);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|-----------|--------------------------------|\n| `weight` | `Integer` | The stroke weight of the icon. |\n\n#### Return\n\n\n[MaterialIcon](#) --- This object, for chaining."]]