StreetViewPanoramaFragment streetViewFragment = (StreetViewPanoramaFragment) getFragmentManager().findFragmentById(R.id.g_map_street);
streetViewFragment.getStreetViewPanoramaAsync(this);
@Override
public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) {
streetView = streetViewPanorama;
streetViewPanorama.setPosition(new LatLng(Latitude, Longtitude));
}
我有一个 Heading 值,该值返回角度。
https://maps.googleapis.com/maps/api/streetview?size=800x800&location=%s,%s&heading=%s
使用它,我可以正确获取Streetview图片,但不能在 StreetViewPanoramaFragment 中使用。
答案 0 :(得分:0)
最后,经过大量的研发,我找到了这个解决方案及其对我有用。
@Override
public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) {
streetViewPanorama.setPosition(new LatLng(Latitude, Longtitude));
try {
//Change angle of street view
final int DURATION = 1000;
StreetViewPanoramaCamera camera = new StreetViewPanoramaCamera.Builder()
.zoom(streetViewPanorama.getPanoramaCamera().zoom)
.tilt(streetViewPanorama.getPanoramaCamera().tilt)
.bearing(streetViewPanorama.getPanoramaCamera().bearing + angle) // angle value by Maps Api
.build();
streetViewPanorama.animateTo(camera, DURATION);
} catch (Exception e) {
e.printStackTrace();
}
}