Android:在不启动意图的情况下使用 StreetView
我正在开发一个简单的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,情况并非如此。
MapView
支持isStreetView()
和setStreetView()
,但我认为这只是绘制蓝色线来指示 StreetView 数据可用的位置。Not that I am aware of.
MapView
supportsisStreetView()
andsetStreetView()
, but I think that just draws the blue lines indicating where StreetView data is available.