在我的应用程序中,我使用的是谷歌地图卫星视图,但它不像在谷歌地图应用程序中那样显示我所在城镇的所有标签。以下是我的应用程序和Google地图应用程序的屏幕截图:
我的应用程序:My application Screenshot
谷歌地图应用程序:Google Maps Application Screenshot
下面是我的代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location_route);
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
if (status != ConnectionResult.SUCCESS) {
int requestCode = 10;
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
dialog.show();
}
else{
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
try {
mGoogleMap = googleMap;
mGoogleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
mGoogleMap.setMyLocationEnabled(true);
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
Location location = locationManager.getLastKnownLocation(provider);
if (location != null) {
onLocationChanged(location);
}
drawYourMarker(yourLocation);
drawPharmacyMarker(pharmacyLocation);
// Checks, whether start and end locations are captured
if (yourLocation != null && pharmacyLocation != null) {
String url = getDirectionsUrl(yourLocation, pharmacyLocation);
DownloadTask downloadTask = new DownloadTask();
downloadTask.execute(url);
}
} catch (SecurityException e) {
e.printStackTrace();
}
}有没有办法让我的应用程序像Google Maps应用程序那样显示更多的标签?
发布于 2016-07-21 07:27:01
这是因为Google地图应用程序使用了Google提供的所有API。您正在寻找的API是Google Places API,用于获取所有标签。
您必须在Google API控制台上打开它,并遵循此tutorial来实现将它们放到您的地图上。
希望这能有所帮助。
发布于 2020-05-14 14:20:16
您需要更改地图类型
mGoogleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);至
mGoogleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);https://stackoverflow.com/questions/38492416
复制相似问题