Значки мест обозначают различные типы мест (например, кафе, библиотеки и музеи). Вы можете запросить URL-адреса значков в формате PNG, а также соответствующий цвет фона значков с помощью запросов «Текущее место » и «Сведения о месте (новое)» .
Чтобы запросить изображение значка и цвет фона для места, включите в запрос следующие поля:
Place.Field.ICON_MASK_URL
Place.Field.ICON_BACKGROUND_COLOR
В следующих примерах показано использование изображения значка и цвета фона из запроса текущего места или сведений о месте:
Котлин
// Set the image view's background color to match the place's icon background colorimageView.setBackgroundColor(place.iconBackgroundColor)// Fetch the icon using Glide and set the result in the image viewGlide.with(this).load(place.iconUrl).into(imageView)
Ява
// Set the image view's background color to match the place's icon background colorimageView.setBackgroundColor(place.getIconBackgroundColor());// Fetch the icon using Glide and set the result in the image viewGlide.with(this).load(place.getIconUrl()).into(imageView);
В этом примере используется библиотека загрузки изображений Glide , но вы можете использовать библиотеку загрузки изображений по вашему выбору.
ICON_BACKGROUND_COLOR возвращает цветовой код по умолчанию для категории места.
Размещайте запросы на цвет значков и фона
В следующих таблицах показаны все доступные значки мест по категориям. По умолчанию они отображаются черным значком. Цвет фона значка определяется категорией места.
Категория места: Еда и напитки (цвет фона значка #FF9E67)
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-02-28 UTC."],[[["Place icons, available in PNG format, represent various place types like restaurants and libraries, accessible through Current Place and Place Details requests."],["You can retrieve the icon URL using `Place.Field.ICON_MASK_URL` and the background color using `Place.Field.ICON_BACKGROUND_COLOR`."],["The icon URL is a base URL for a non-colored PNG that is overlaid on a background color representing the place's category, like #FF9E67 for food and drink."],["Code examples are provided in Kotlin and Java to demonstrate fetching and displaying the icon and background color using an image loading library like Glide."],["A comprehensive table showcases available place icons categorized by type, along with their corresponding background colors."]]],["Place icons, indicating different types of locations, can be accessed via URLs in PNG format along with their background colors. Requests for icons and colors require the `ICON_MASK_URL` and `ICON_BACKGROUND_COLOR` fields. The icon URL, obtained through `Place.Field.ICON_MASK_URL`, should be consistently referenced due to potential changes. `ICON_BACKGROUND_COLOR` returns the category's default color. The document then details various place categories and their associated icons and background colors. For example food and drink has the background color #FF9E67.\n"]]