Android GoogleMaps:一些建筑物消失了
Android GoogleMaps: some buildings disappeared
我正在尝试为我的应用程序添加 GoogleMap。
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
...
mMapView.onCreate(savedInstanceState);
MapsInitializer.initialize(context);
mMapView.getMapAsync(this);
...
}
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
mGoogleMap.setBuildingsEnabled(true);
mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mGoogleMap.setTrafficEnabled(true);
mGoogleMap.getUiSettings().setZoomControlsEnabled(true);
mGoogleMap.getUiSettings().setCompassEnabled(true);
}
但由于某些原因,我的应用程序中的 google 地图显示的建筑物层比原始 google 地图应用程序显示的详细程度低。 (也许还有一些其他差异,但建筑物对我的应用程序至关重要,我注意到了这一点)
如果再缩放两次,我只能强制在我的应用程序中显示建筑物。它已经是 3d 建筑了。因此,一些建筑物(具有 3d 视图的建筑物)在我缩放到足以显示 3d 建筑物之前不会显示。其他(没有 3d 视图的)显示正确且完全像 google 地图应用程序。
如何在我的应用程序中显示所有建筑物?
- 我正在 Android 5.1.1
上进行测试
- DisplayMetrics{密度=1.5,宽度=480,高度=854,缩放密度=1.5,xdpi=160.421,ydpi=159.497}
- 定位点:https://www.google.ru/maps/@64.543017,40.5261856,16z
Google Android 上的地图本机应用程序和 Google 中的地图 Maps Android API v2 当前具有不同样式的底图图块。本机 Google 地图应用程序在一段时间前更改了外观,并在本文中宣布
https://www.blog.google/products/maps/google-maps-gets-new-look/
目前的 API 看起来很旧,因此您在比较本机应用程序和您的应用程序时注意到了差异。好消息是 Google 很快就会更新 API 中的磁贴样式,他们在这个博客 post
中宣布了这一变化
https://maps-apis.googleblog.com/2018/02/updated-basemap-style-for-google-maps.html
根据博客 post 地图 Android API 的新样式将于 2018 年 3 月初推出。敬请关注 [=47] 中相应的功能请求=] 问题跟踪器
https://issuetracker.google.com/issues/72780606
希望我的回答能解决您的疑惑!
更新
Google 宣布 Google Play 服务 12.0.0
现在可以使用新的底图样式
Enabled opt-in for the new basemap style. To opt-in, add the following tag to your AndroidManifest.xml file, within the tags. The device must have at least Google Play Services version 12.0.0 in order for the opt-in to work. See the blog post for more information about the new style.
<meta-data android:name="com.google.android.gms.maps.API_OPTIONS"
android:value="B3MWHUG2MR0DQW"/>
我正在尝试为我的应用程序添加 GoogleMap。
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
...
mMapView.onCreate(savedInstanceState);
MapsInitializer.initialize(context);
mMapView.getMapAsync(this);
...
}
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
mGoogleMap.setBuildingsEnabled(true);
mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mGoogleMap.setTrafficEnabled(true);
mGoogleMap.getUiSettings().setZoomControlsEnabled(true);
mGoogleMap.getUiSettings().setCompassEnabled(true);
}
但由于某些原因,我的应用程序中的 google 地图显示的建筑物层比原始 google 地图应用程序显示的详细程度低。 (也许还有一些其他差异,但建筑物对我的应用程序至关重要,我注意到了这一点)
如果再缩放两次,我只能强制在我的应用程序中显示建筑物。它已经是 3d 建筑了。因此,一些建筑物(具有 3d 视图的建筑物)在我缩放到足以显示 3d 建筑物之前不会显示。其他(没有 3d 视图的)显示正确且完全像 google 地图应用程序。
如何在我的应用程序中显示所有建筑物?
- 我正在 Android 5.1.1 上进行测试
- DisplayMetrics{密度=1.5,宽度=480,高度=854,缩放密度=1.5,xdpi=160.421,ydpi=159.497}
- 定位点:https://www.google.ru/maps/@64.543017,40.5261856,16z
Google Android 上的地图本机应用程序和 Google 中的地图 Maps Android API v2 当前具有不同样式的底图图块。本机 Google 地图应用程序在一段时间前更改了外观,并在本文中宣布
https://www.blog.google/products/maps/google-maps-gets-new-look/
目前的 API 看起来很旧,因此您在比较本机应用程序和您的应用程序时注意到了差异。好消息是 Google 很快就会更新 API 中的磁贴样式,他们在这个博客 post
中宣布了这一变化https://maps-apis.googleblog.com/2018/02/updated-basemap-style-for-google-maps.html
根据博客 post 地图 Android API 的新样式将于 2018 年 3 月初推出。敬请关注 [=47] 中相应的功能请求=] 问题跟踪器
https://issuetracker.google.com/issues/72780606
希望我的回答能解决您的疑惑!
更新
Google 宣布 Google Play 服务 12.0.0
现在可以使用新的底图样式Enabled opt-in for the new basemap style. To opt-in, add the following tag to your AndroidManifest.xml file, within the tags. The device must have at least Google Play Services version 12.0.0 in order for the opt-in to work. See the blog post for more information about the new style.
<meta-data android:name="com.google.android.gms.maps.API_OPTIONS"
android:value="B3MWHUG2MR0DQW"/>