med*_*hys 28 android google-maps
我在网上搜索了很多,但我找不到任何能回答我问题的内容.当我启用MyLocation时
gmap.setMyLocationEnabled(真)
我自动获得一个按钮,将地图置于我当前位置的中心位置.我想删除它,所以我问你该怎么做.我希望你们中的某些人可以帮助我!
joh*_*lis 160
在GoogleMap对象上调用以下方法之后:
map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);
Run Code Online (Sandbox Code Playgroud)
您应该看到当前位置指示器(蓝色圆圈),但没有控件可以将地图置于该位置的中心位置.
BBo*_*Doo 10
这是非常简单的答案;
gmap.setMyLocationEnabled(true); ==> means "to center the map on my current location"
gmap.setMyLocationEnabled(false); ==> means "NOT to center the map on my current location"
Run Code Online (Sandbox Code Playgroud)
[更新]
如果您要删除地图上的位置按钮,请在代码中搜索以下内容并将其删除;
public void setMyLocationButtonEnabled(View v) {
if (!checkReady()) {
return;
}
// Enables/disables the my location button (this DOES NOT enable/disable the my location
// dot/chevron on the map). The my location button will never appear if the my location
// layer is not enabled.
mUiSettings.setMyLocationButtonEnabled(((CheckBox) v).isChecked());
}
public void setMyLocationLayerEnabled(View v) {
if (!checkReady()) {
return;
}
// Enables/disables the my location layer (i.e., the dot/chevron on the map). If enabled, it
// will also cause the my location button to show (if it is enabled); if disabled, the my
// location button will never show.
mMap.setMyLocationEnabled(((CheckBox) v).isChecked());
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24862 次 |
| 最近记录: |