我已经设置了我的应用程序,使用下面的代码将 Google map 启动到设定位置,但 map 显示已放大,您看不到任何道路,您必须手动缩小才能看到任何内容。如何使用下面的代码设置缩放级别我尝试过 setZoom(16);但这没有任何效果。
if (mapnav == 10) {
String uri = "geo: 53.777969,-1.571474";
setZoom(16);
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(i);}
我还可以启动路线而不是 map
最佳答案
您可以在 URI 中指定缩放级别,例如 “geo: 53.777969,-1.571474?z=23”
Google Maps
geo:latitude,longitude geo:latitude,longitude?z=zoom geo:0,0?q=my+street+address geo:0,0?q=business+near+city
VIEW
Opens the Maps application to the given location or query. The Geo URI scheme (not fully supported) is currently under development.
The z field specifies the zoom level. A zoom level of 1 shows the whole Earth, centered at the given lat,lng. A zoom level of 2 shows a quarter of the Earth, and so on. The highest zoom level is 23. A larger zoom level will be clamped to 23.
对于 Google 导航部分,您可以使用 "google.navigation:q="+location
,其中 location
是坐标。 Intent Intent.ACTION_VIEW
。
资源:
同一主题:
关于java - 从应用程序启动 Google map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3908856/