Android:在不启动 Intent 的情况下使用街景

标签 android google-street-view

我正在开发一个简单的 Android 应用程序,我希望在用户单击主屏幕上的按钮后,显示已知坐标的街景。

我可以像这样创建显示 map :

    mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);

    mapController = mapView.getController();
    mapController.setZoom(6); // Zoom 1 is world view

    GeoPoint point = new GeoPoint(...);
    mapController.setCenter(point);
    mapController.animateTo(point);

通过这种方法,我可以轻松地在 map 上添加我自己的按钮、叠加层等,我的用户可以根据他们在 map 上的当前位置按下这些按钮来执行某些操作。

我不想显示 map ,而是显示街景 View ,上面显示我自己的自定义按钮(以及标准的谷歌按钮)。我发现显示街景的唯一方法如下:

String uri = "google.streetview:cbll="+ latitude+","+longitude+"&cbp=1,99.56,,1,-5.27&mz=21";
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
startActivity(streetView);

有没有什么方法可以启动街景,通过它可以嵌入到我的应用程序中,这样我就可以在街景顶部放置按钮,让我的用户可以根据他们当前的位置执行某些操作?

非常感谢,

r3mo

最佳答案

Is there any way to start a streetview in a way through which it could be embedded into my application so that I could put buttons on top of the streetview which would allow my user to do certain actions based on their current location?

据我所知不是。 MapView 支持 isStreetView()setStreetView(),但我认为这只是绘制蓝线指示 StreetView 数据可用的位置。

关于Android:在不启动 Intent 的情况下使用街景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3890453/

相关文章:

Java Android 使用无键 JSON 对象迭代 JSON 数组

java - 如何使用 eclipse 在云上进行开发?

android - 构建应用程序以通过 Web 服务器进行身份验证

Android Studio gradle-###-bin.zip 与 gradle-###-all.zip

javascript - 如何知道街景全景图是在室内还是室外

android - 在 google maps api 中,这个地址是什么意思

javascript - 从地址获取嵌入的街景 View

java - 使用广播接收器接收长进程短信的最佳方式

javascript - 谷歌地图 API v3 : Control the direction of a street view and use address instead of lat/lon

javascript - 谷歌街景黑屏