检查是否存在Google Streetview位置以隐藏视图 [英] Check if google streetview location exists or not to hide a view
问题描述
我目前正在开发一个Android应用程序,该程序要求我在我的应用程序中使用街景.我做了一个StreetViewActivity来显示街景.但是在该活动之前,我还有另一个名为位置活动"的活动,该活动具有将用户带到StreetViewActivity的按钮.现在,我的问题是如何检查提供的纬度和经度是否没有街景视图,然后它应该隐藏该按钮,以防止用户进入StreetViewActivity?我可以检查我的StreetViewActivity中是否存在纬度,但是我需要签入上一个活动.
I am currently working on an android application which requires me to use street view in my app. I have made a StreetViewActivity to show the street view. But before that activity, I have another activity called Location Activity that has a button that takes the user to the StreetViewActivity. Now my question is how can I check if the latitude and longitude that is provided don't have a streetview then it should hide the button that would prevent the user from going to the StreetViewActivity? I can check if the lat lng exists in my StreetViewActivity but I need to check in the previous activity.
到目前为止,我在我的StreetViewActivity中所做的事情:
What I have done so far in My StreetViewActivity:
LOCATION = new LatLng(Latitude, Longitude);
SupportStreetViewPanoramaFragment streetViewPanoramaFragment =
(SupportStreetViewPanoramaFragment)
getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
streetViewPanoramaFragment.getStreetViewPanoramaAsync(
new OnStreetViewPanoramaReadyCallback() {
@Override
public void onStreetViewPanoramaReady(final StreetViewPanorama panorama) {
if (savedInstanceState == null) {
panorama.setPosition(LOCATION);
panorama.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
@Override
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation loc) {
if (loc != null && loc.links != null) {
//panorama.setPosition(LOCATION);
}else{
Toast.makeText(PropertyStreetViewActivity.this, "No Street View Available For This Location", Toast.LENGTH_LONG)
.show();
finish();
}
}
});
}
}
});
以及我的LocationActivity的屏幕截图:
And a Screenshot of my LocationActivity:
推荐答案
默认情况下,在地图上启用了街景,并且街景衣夹人"控件将显示在导航(缩放和平移)控件中.您可以通过将streetViewControl设置为false来在地图的MapOptions中隐藏此控件.
By default, Street View is enabled on a map and a Street View Pegman control appears integrated within the navigation (zoom and pan) controls. You may hide this control within the map's MapOptions by setting streetViewControl to false.
streetViewControl: false
这篇关于检查是否存在Google Streetview位置以隐藏视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!