java - 从应用程序启动 Google map

标签 java android eclipse google-maps

我已经设置了我的应用程序,使用下面的代码将 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/

相关文章:

java - 将 GetCheckedRadioButtonId() 与外部单选按钮组一起使用

java - 是否可以在 spring boot 中创建一个通用的 CRUD

java - 如果类名作为字符串传递,如何动态调用类的方法

android - 如何设置 TextView 的文本?

java - 绑定(bind) Spinner 后,如何不选择第一项?

c - 如何向 Eclipse 项目添加第二个源目录

java - 批量创建 Java 类 stub

java - Hadoop "Could not find or load main class com.sun.tools.javac.Main"

visual-studio-2008 - Eclipse vs VS IDE 单元测试一个类

android - 小部件未出现在小部件列表中