地点图标表示各种类型的地点(例如咖啡馆、 图书馆和博物馆)。您可以使用当前地点和地点详情(新)请求来请求 PNG 格式的图标的网址,以及相应的图标背景颜色。
要请求地点的图标图片和背景颜色,请添加 请求中的以下字段:
Place.Field.ICON_MASK_URLPlace.Field.ICON_BACKGROUND_COLOR
以下示例演示了如何使用图标图片和背景颜色 从“当前地点”或“地点详情”请求中获取:
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)  | 
  |||
| 
       ATM  | 
    
       银行  | 
    
       加油站  | 
    
       住宿  | 
  
| 
       邮局  | 
  |||
| 地点类别:娱乐 (图标背景颜色 #13B5C7)  | 
  |||
| 
       水族馆、旅游  | 
    
       高尔夫  | 
    
       历史古迹  | 
    
       电影院  | 
  
| 
       博物馆  | 
    
       剧院  | 
  ||
| 地点类别:交通 (图标背景颜色 #10BDFF)  | 
  |||
| 
       机场  | 
    
       公交车、拼车、出租车  | 
    
       火车/轨道交通  | 
  |
| 地点类别:市政/一般/宗教 (图标背景颜色 #7B9EB0)  | 
  |||
| 
       墓地  | 
    
       市政建筑  | 
    
       图书馆  | 
    
       纪念碑  | 
  
| 
       停车场  | 
    
       学校(小学、中学、大学)  | 
    
       宗教场所(基督教)  | 
  |
| 
       宗教场所(印度教)  | 
    
       宗教场所(伊斯兰教)  | 
    
       宗教场所(耆那教)  | 
    
       宗教场所(犹太教)  | 
  
| 
       宗教场所(锡克教)  | 
    
       一般业务  | 
  ||
| 地点类别:户外 (图标背景颜色 #4DB546)  | 
  |||
| 
       乘船  | 
    
       野营  | 
    
       公园  | 
    
       体育馆  | 
  
| 
       动物园  | 
  |||
| 地点类别:紧急状况 (图标背景颜色 #F88181)  | 
  |||
| 
       医院  | 
    
       警察局  | 
  ||