我正在开发一个简单的 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/