---
title: " 百度地图SDK 3.x 隐藏缩放按钮"
author: "15035554141"
date: "2014-11-13T15:27:47Z"
tags: []
categories: ["移动开发"]
slug: "sdk-3-x"
draft: false
lastmod: "2014-11-13T15:27:47Z"
id: 2155495
url: "https://15035554141.iteye.com/blog/2155495"
---

之前的百度地图2.X版本 ,有些地方设计的是蛮合理的，有些地方不太合理，但是现在升级到3.x之后  特么的  发现合理的地方改的不合理 ，不合理的地方改合理了。就拿这个缩放控件来说，以前是直接在  mapVIew里  set  一下就好了  这里搞得非得来个BaiduMapOptions  来设置。用了这个类 发现又没法正常的使用findViewById(R.id.bmapView);这个方法来获取mapview。按照小度的方法来操作的话又会很复杂。  
 
后来找了个 比较简单的方法  来弄。    就是不按照小度的套路来操作。
这里用的方法是  : mapview.getChilds() 循环判断 如果一个 child 是 ZoomControls 就把它  gone 掉
private void hideZoomCtler() {  if(mMapView==null)  return ;  int count = mMapView.getChildCount();  for (int i = 0; i &lt; count; i++) {  View child = mMapView.getChildAt(i);  // 隐藏百度logo ZoomControl  if (child instanceof ImageView || child instanceof ZoomControls)  child.setVisibility(View.INVISIBLE);  } }
 或者  
写道
mMapView.removeViewAt(2);  // 删除百度地图logo  mMapView.removeViewAt(1);
 
原文出处：http://blog.csdn.net/weizongwei5/article/details/39178243
谢谢弯弯~