地點圖示會指出不同類型的地點 (例如咖啡店、 圖書館和博物館)。您可以使用 Current Place 和 Place Details (New) 要求,取得 PNG 格式的圖示網址,以及對應的圖示背景顏色。
如需要求地點的圖示圖片和背景顏色,請在 下列欄位:
- Place.Field.ICON_MASK_URL
- Place.Field.ICON_BACKGROUND_COLOR
以下範例示範如何使用圖示圖片和背景顏色 從 Current Place 或 Place Details 要求中:
Kotlin
// Set the image view's background color to match the place's icon background color val bgColor = place.iconBackgroundColor ?: Color.TRANSPARENT binding.placesIconResult.setBackgroundColor(bgColor) // Fetch the icon using Glide and set the result in the image view Glide.with(this) .load(place.iconMaskUrl) .into(binding.placesIconResult)
Java
// It's recommended to retrieve the icon_background_color and icon_mask_base_uri fields from a // FetchPlaceRequest and pass them to the Place object. // Set the image view's background color to match the place's icon background color Integer iconBackgroundColor = place.getIconBackgroundColor(); if (iconBackgroundColor == null) { iconBackgroundColor = Color.TRANSPARENT; } binding.placesIconResult.setBackgroundColor(iconBackgroundColor); // Fetch the icon using Glide and set the result in the image view Glide.with(this) .load(place.getIconMaskUrl()) .into(binding.placesIconResult);
欄位
每個地點圖示都包含以下三個欄位:
- ICON_MASK_URL會傳回非彩色 PNG 圖示的基準網址。
- ICON_BACKGROUND_COLOR會傳回地點類別的預設顏色代碼。
地點圖示和背景顏色要求
下表依類別列出所有可用的地點圖示。圖示會預設以黑色字符顯示。圖示背景顏色取決於地點類別。
| 地點類別:餐飲 (圖示背景顏色 #FF9E67) | |||
|---|---|---|---|
| 酒吧、 夜店 | 咖啡館 | 餐廳、麵包店 | |
| 地點類別:零售 (圖示背景顏色 #4B96F3) | |||
| 書籍、服飾、電子產品、珠寶、鞋子、 購物中心/商場 |  便利商店 | 雜貨店、超市 | 藥局 | 
| 地點類別:服務 (圖示背景顏色 #909CE1) | |||
| 提款機 | 銀行 | 加油站 | 住宿地點 | 
| 郵局 | |||
| 地點類別:娛樂 (圖示背景顏色 #13B5C7) | |||
| 水族館、觀光旅遊 | 高爾夫 | 歷史古蹟 | 電影 | 
| 博物館 | 劇場 | ||
| 地點類別:交通運輸 (圖示背景顏色 #10BDFF) | |||
| 機場 | 公車、代僱駕駛服務、計程車 | 火車/鐵路 | |
| 地點類別:市政/一般/宗教 (圖示背景顏色 #7B9EB0) | |||
| 墓園 | 市政建築 | 圖書館 | 紀念碑 | 
| 停車場 | 學校 (小學、中學、大專院校) | 宗教 (基督教) | |
| 宗教 (印度教) | 宗教 (伊斯蘭教) | 宗教 (耆那教) | 宗教 (猶太教) | 
| 宗教 (錫克教) | 一般業務 | ||
| 地點類別:戶外 (圖示背景顏色 #4DB546) | |||
| 乘船 | 露營 | 公園 | 體育場館 | 
| 動物園 | |||
| 地點類別:緊急狀況 (圖示背景顏色 #F88181) | |||
| 醫院 | 警察局 | ||