如何禁用Google地图上的"放大"按钮?
我试着寻找像这样的命令:
map.getUiSettings().setZoomControlsEnabled(true)...SOMETHING
但没有任何东西存在.
我想离开创建自己的缩放按钮作为最后的手段.
更新:我应该澄清,我只想禁用放大按钮,而不是整个缩放控制.
您使用的设置是正确的,但要禁用它,它应该是假的.
map.getUiSettings().setZoomControlsEnabled(false);
希望我的问题正确..
编辑
不幸的是,你无法隐藏一个缩放按钮,你可以做的是隐藏两个按钮并创建自己的自定义缩放控件并将它们放在地图上.
@Coderji说这是不可能的.我说有可能:-)
您可以隐藏缩放按钮(+或 - )之一并对其执行所有操作,例如普通视图(边距,大小,填充等)
SupportMapFragment mapView = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)); View zoomControls = mapView.getView().findViewById(0x1); for(int i=0;i<((ViewGroup)zoomControls).getChildCount();i++){ View child=((ViewGroup)zoomControls).getChildAt(i); if (i==0) { // there is your "+" button, zoom in } if (i==1) { // there is your "-" button, I hide it in this example child.setVisibility(View.GONE); } }