Android:在不启动意图的情况下使用 StreetView

发布于 2024-09-26 12:09:25 字数 898 浏览 0 评论 0原文

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

我可以像这样创建显示地图:

    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);

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

我想显示一个街景,而不是显示地图,并在其顶部显示我自己的自定义按钮(以及标准的谷歌按钮)。我发现显示街景的唯一方法如下:

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

I'm working on a simple android app in which I want to, once the user has clicked a button on the main screen, display the streetview of known coordinates.

I can create display a map like so:

    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);

Through this method, I could easily add my own buttons, overlays, etc over the map which my user could press to do certain actions based on their current location on the map.

I want to, instead of displaying a map, display a streetview with my own custom buttons displayed on top of it (along with the standard google ones). The only way I've found of displaying a streetview is as follows:

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);

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?

Many thanks in advance,

r3mo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖公主 2024-10-03 12:09:25

有什么方法可以启动街景,使其可以嵌入到我的应用程序中,以便我可以在街景顶部放置按钮,从而允许我的用户根据当前位置执行某些操作?< /p>

据我所知,情况并非如此。 MapView 支持 isStreetView()setStreetView(),但我认为这只是绘制蓝色线来指示 StreetView 数据可用的位置。

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?

Not that I am aware of. MapView supports isStreetView() and setStreetView(), but I think that just draws the blue lines indicating where StreetView data is available.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文