Android的制作消失或删除地图V2蓝点 [英] Android Make Disappear or remove the blue dot on the map v2
问题描述
我想取代我的应用程序的地图上的蓝色圆点。
我的本意是,而不是通常的蓝点,显示图标形状的平面。
我做到这一点,它完美的作品如下:
I'm trying to replace the blue dot on the map of my app. My intention is that instead of the usual blue dot, show an icon shaped plane. I achieve this and it works perfectly as follows:
//...
GoogleMap.OnMyLocationChangeListener myLocationChangeListener = new GoogleMap.OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(Location location) {
LatLng loc = new LatLng(location.getLatitude(), location.getLongitude());
try{
myPositionMarker.remove();
} catch (Exception e){
//..
}
myPositionMarker = mMap.addMarker(new MarkerOptions()
.flat(true)
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.plane))
.anchor(0.5f, 0.5f)
.position(
new LatLng(location.getLatitude(), location
.getLongitude())));
//...
}
正如我所说的,这工作正常,但现在我看到我的图标和蓝点:
As I said, this works fine, but now I see my icon and the blue dot:
我已经尝试了许多方法来做到这一点,但无法找到任何的工作。
有删除按钮我的位置的例子很多,但我不希望将其删除。
I have tried many ways to do it, but can not find any that work. There are many examples of removing the button "My Location" but I do not want to delete it.
我要删除的蓝色圆点。
我AP preciate任何帮助。
在此先感谢和问候
I appreciate any help. Thanks in advance and greetings
*更新:
应对由@tyczj所写的,我正在拆卸我的位置按钮如下注释:
Responding to the comment written by @tyczj i'm removing my location button as follows:
mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(false);
因此,我的位置按钮不可见,但蓝点是可见的。
改变两个布尔为false,然后不再起作用。没有蓝点,但既不位置更新。
我有点困惑。我在做什么错了?
Thus, my location button is not visible, but the blue dot is visible. Change the two boolean to false and then no longer works. No blue dot, but neither location update. I'm a little confused. What am I doing wrong?
感谢
推荐答案
如果您想拥有谷歌的进入到我的定位按钮你必须有谷歌的蓝点。如果你不希望谷歌的蓝点,你也就不会有谷歌的进入到我的定位按钮,因此你必须自己去实现它。只需添加<一个href=\"https://developer.android.com/reference/com/google/android/gms/location/FusedLocationProviderApi.html#requestLocationUpdates%28com.google.android.gms.common.api.GoogleApiClient,%20com.google.android.gms.location.LocationRequest,%20com.google.android.gms.location.LocationListener%29\"相对=nofollow> requestLocationUpdates(GoogleApiClient客户端,LocationRequest要求,LocationListener的听众)跟踪用户的位置,并添加自定义走出去对我的定位按钮在地图上的顶部。
If you want to have "google's go-to-my-location-button" you have to have "google's blue dot". If you don't want "google's blue dot" you also will not have "google's go-to-my-location-button" and thus you'll have to implement it by yourself. Just add requestLocationUpdates (GoogleApiClient client, LocationRequest request, LocationListener listener) to track user location and add your custom "go-to-my-location-button" on top of map.
这篇关于Android的制作消失或删除地图V2蓝点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!