转自:http://blog.csdn.net/jing__jie/article/details/51800042

之前讲了百度地图定位和地图基本操作,这篇博客讲一下,怎么去给地图添加覆盖物,并当点击覆盖物的时候显示详细信息。 
要给地图添加覆盖物,首先需要覆盖物的经纬度,如果还要实现点击事件,显示详细的信息,还需要覆盖物的描述信息(如图片,位置名称等),所以先新建一个实体类,来存放这些信息。 
实体类必须实现序列化接口

package com.zwinsoft.mybaidumap.entity;import java.io.Serializable;/*** 地图标注信息实体类* @author jing__jie**/
public class MarkerInfoUtil implements Serializable{private static final long serialVersionUID = 8633299996744734593L;private double latitude;//纬度private double longitude;//经度private String name;//名字private int imgId;//图片private String description;//描述//构造方法public MarkerInfoUtil() {}public MarkerInfoUtil(double latitude, double longitude, String name, int imgId, String description) {super();this.latitude = latitude;this.longitude = longitude;this.name = name;this.imgId = imgId;this.description = description;}//toString方法@Overridepublic String toString() {return "MarkerInfoUtil [latitude=" + latitude + ", longitude=" + longitude + ", name=" + name + ", imgId="+ imgId + ", description=" + description + "]";}//getter setterpublic double getLatitude() {return latitude;}public void setLatitude(double latitude) {this.latitude = latitude;}public double getLongitude() {return longitude;}public void setLongitude(double longitude) {this.longitude = longitude;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getImgId() {return imgId;}public void setImgId(int imgId) {this.imgId = imgId;}public String getDescription() {return description;}public void setDescription(String description) {this.description = description;}
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65

在activity中添加几条markerinfo数据,用来显示marker

private void setMarkerInfo() {infos = new ArrayList<MarkerInfoUtil>();infos.add(new MarkerInfoUtil(117.216624,39.142693,"天津站",R.drawable.tianjinzhan,"天津站,俗称天津东站,隶属北京铁路局管辖"));infos.add(new MarkerInfoUtil(117.176955,39.111345,"南开大学",R.drawable.nankai,"正式成立于1919年,是由严修、张伯苓秉承教育救国理念创办的综合性大学。"));infos.add(new MarkerInfoUtil(117.174081,39.094994,"天津水上公园",R.drawable.shuishang,"天津水上公园原称青龙潭,1951年7月1日正式对游客开放,有北方的小西子之称。"));}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

在activity_main.xml中,添加一个按钮,当点击的时候显示marker,再次点击的时候marker消失。

case R.id.btn_marker:if(!showMarker){//显示markeraddOverlay(infos);showMarker = true;}else{//关闭显示markermBaiduMap.clear();showMarker = false;}break;//显示marker
private void addOverlay(List<MarkerInfoUtil> infos2) {//清空地图mBaiduMap.clear();//创建marker的显示图标BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.ditu1);LatLng latLng = null;Marker marker;OverlayOptions options;for(MarkerInfoUtil info:infos){//获取经纬度latLng = new LatLng(info.getLatitude(),info.getLongitude());//设置markeroptions = new MarkerOptions().position(latLng)//设置位置.icon(bitmap)//设置图标样式.zIndex(9) // 设置marker所在层级.draggable(true); // 设置手势拖拽;//添加markermarker = (Marker) mBaiduMap.addOverlay(options);//使用marker携带info信息,当点击事件的时候可以通过marker获得info信息Bundle bundle = new Bundle();//info必须实现序列化接口bundle.putSerializable("info", info);marker.setExtraInfo(bundle);}//将地图显示在最后一个marker的位置MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);mBaiduMap.setMapStatus(msu);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42

这样marker就显示出来了。效果图: 
 
下面需要添加marker的点击事件,使marker在点击的时候,显示info中的信息。首先需要一个布局用来展示图片,名称等信息。

<RelativeLayout
    android:id="@+id/rl_marker"android:layout_alignParentTop="true"android:layout_width="match_parent"android:layout_height="220dp" android:background="#ffffff"android:visibility="gone"android:clickable="true"><!-- 如果不添加这个属性,当点击布局时,会和地图点击事件干扰 --><ImageView android:id="@+id/iv_img"android:layout_width="match_parent"android:layout_height="150dp"android:layout_margin="10dp"/><TextView android:id="@+id/tv_name"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@id/iv_img"android:textSize="18sp"android:textColor="#000000"android:layout_marginBottom="5dp"/><TextView android:id="@+id/tv_description"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@id/tv_name"android:textSize="14sp"android:textColor="#000000"/>
</RelativeLayout>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

添加marker的点击事件

//添加marker点击事件的监听
mBaiduMap.setOnMarkerClickListener(new OnMarkerClickListener() {@Overridepublic boolean onMarkerClick(Marker marker) {//从marker中获取info信息Bundle bundle = marker.getExtraInfo();MarkerInfoUtil infoUtil = (MarkerInfoUtil) bundle.getSerializable("info");//将信息显示在界面上ImageView iv_img = (ImageView)rl_marker.findViewById(R.id.iv_img);iv_img.setBackgroundResource(infoUtil.getImgId());TextView tv_name = (TextView)rl_marker.findViewById(R.id.tv_name);tv_name.setText(infoUtil.getName());TextView tv_description = (TextView)rl_marker.findViewById(R.id.tv_description);tv_description.setText(infoUtil.getDescription());//将布局显示出来rl_marker.setVisibility(View.VISIBLE);return true;}
});
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

效果图: 
 
再添加一个地图点击事件,当点击地图的时候,将详细信息布局影藏

//地图点击事件
mBaiduMap.setOnMapClickListener(new OnMapClickListener() {
@Override
public boolean onMapPoiClick(MapPoi arg0) {return false;
}
@Override
public void onMapClick(LatLng arg0) {rl_marker.setVisibility(View.GONE);
}
});
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

其中点击显示info信息的布局是固定的,有时候我们需要显示一个infowindow,跟随在marker上,这就需要百度地图提供的InfoWindow来实现。 
在marker的点击监听中添加

//infowindow中的布局
TextView tv = new TextView(MainActivity.this);
tv.setBackgroundResource(R.drawable.infowindow);
tv.setPadding(20, 10, 20, 20);
tv.setGravity(Gravity.CENTER);
tv.setTextColor(android.graphics.Color.WHITE);
tv.setText(infoUtil.getName());
bitmapDescriptor = BitmapDescriptorFactory.fromView(tv);
//infowindow位置
LatLng latLng = new LatLng(infoUtil.getLatitude(), infoUtil.getLongitude());
//infowindow点击事件
OnInfoWindowClickListener listener = new OnInfoWindowClickListener() {@Overridepublic void onInfoWindowClick() {//隐藏infowindowmBaiduMap.hideInfoWindow();}
};
//显示infowindow,-47是偏移量,使infowindow向上偏移,不会挡住marker
InfoWindow infoWindow = new InfoWindow(bitmapDescriptor, latLng, -47, listener);
mBaiduMap.showInfoWindow(infoWindow);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果图: 
 
下面总结一下MainActivity代码,包含地图控制(地图模式控制,地图缩放控制),地图定位,带方向的定位,显示覆盖物,显示覆盖物点击事件等,希望大家多多指正。

package com.zwinsoft.mybaidumap;import java.util.ArrayList;
import java.util.List;import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BaiduMap.OnMapClickListener;
import com.baidu.mapapi.map.BaiduMap.OnMapStatusChangeListener;
import com.baidu.mapapi.map.BaiduMap.OnMarkerClickListener;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.InfoWindow;
import com.baidu.mapapi.map.InfoWindow.OnInfoWindowClickListener;
import com.baidu.mapapi.map.MapPoi;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.Marker;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.MyLocationConfiguration;
import com.baidu.mapapi.map.MyLocationConfiguration.LocationMode;
import com.baidu.mapapi.map.MyLocationData;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.model.LatLng;
import com.zwinsoft.mybaidumap.entity.MarkerInfoUtil;
import com.zwinsoft.mybaidumap.tools.MyOrientationListener;
import com.zwinsoft.mybaidumap.tools.MyOrientationListener.OnOrientationListener;import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;/*** 我的百度地图首页* @author jing__jie**/
public class MainActivity extends Activity implements OnClickListener {private MapView mMapView = null;private BaiduMap mBaiduMap;private ImageButton ib_large,ib_small,ib_mode,ib_loc,ib_traffic,ib_marker;//模式切换,正常模式private boolean modeFlag = true;//当前地图缩放级别private float zoomLevel; //定位相关private LocationClient mLocationClient;private MyLocationListener mLocationListener;//是否第一次定位,如果是第一次定位的话要将自己的位置显示在地图 中间private boolean isFirstLocation = true;//创建自己的箭头定位private BitmapDescriptor bitmapDescriptor;//经纬度double mLatitude;double mLongitude;//方向传感器监听private MyOrientationListener myOrientationListener;private float mLastX;private List<MarkerInfoUtil> infos;//显示markerprivate boolean showMarker = false;private RelativeLayout rl_marker;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//在使用SDK各组件之前初始化context信息,传入ApplicationContext  //注意该方法要再setContentView方法之前实现  SDKInitializer.initialize(getApplicationContext());  setContentView(R.layout.activity_main);  //初始化控件initView();//初始化地图initMap();//定位initLocation();//创建自己的定位图标,结合方向传感器,定位的时候显示自己的方向initMyLoc();//创建marker信息setMarkerInfo();}  private void setMarkerInfo() {infos = new ArrayList<MarkerInfoUtil>();infos.add(new MarkerInfoUtil(117.216624,39.142693,"天津站",R.drawable.tianjinzhan,"天津站,俗称天津东站,隶属北京铁路局管辖"));infos.add(new MarkerInfoUtil(117.176955,39.111345,"南开大学",R.drawable.nankai,"正式成立于1919年,是由严修、张伯苓秉承教育救国理念创办的综合性大学。"));infos.add(new MarkerInfoUtil(117.174081,39.094994,"天津水上公园",R.drawable.shuishang,"天津水上公园原称青龙潭,1951年7月1日正式对游客开放,有北方的小西子之称。"));}private void initMyLoc() {//初始化图标bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.arrow);//方向传感器监听myOrientationListener = new MyOrientationListener(this);myOrientationListener.setOnOrientationListener(new OnOrientationListener() {@Overridepublic void onOrientationChanged(float x) {mLastX = x;}});}private void initMap() {//获取地图控件引用  mMapView = (MapView) findViewById(R.id.bmapView);// 不显示缩放比例尺mMapView.showZoomControls(false);// 不显示百度地图LogomMapView.removeViewAt(1);//百度地图mBaiduMap = mMapView.getMap();// 改变地图状态MapStatus mMapStatus = new MapStatus.Builder().zoom(15).build();MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);mBaiduMap.setMapStatus(mMapStatusUpdate);//设置地图状态改变监听器mBaiduMap.setOnMapStatusChangeListener(new OnMapStatusChangeListener() {@Overridepublic void onMapStatusChangeStart(MapStatus arg0) {}@Overridepublic void onMapStatusChangeFinish(MapStatus arg0) {}@Overridepublic void onMapStatusChange(MapStatus arg0) {//当地图状态改变的时候,获取放大级别zoomLevel = arg0.zoom;}});//地图点击事件mBaiduMap.setOnMapClickListener(new OnMapClickListener() {@Overridepublic boolean onMapPoiClick(MapPoi arg0) {return false;}@Overridepublic void onMapClick(LatLng arg0) {rl_marker.setVisibility(View.GONE);}});}private void initLocation() {//定位客户端的设置mLocationClient = new LocationClient(this);mLocationListener = new MyLocationListener();//注册监听mLocationClient.registerLocationListener(mLocationListener);//配置定位LocationClientOption option = new LocationClientOption();option.setCoorType("bd09ll");//坐标类型option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要option.setOpenGps(true);//打开Gpsoption.setScanSpan(1000);//1000毫秒定位一次option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到mLocationClient.setLocOption(option);}private void initView() {//地图控制按钮ib_large = (ImageButton)findViewById(R.id.ib_large);ib_large.setOnClickListener(this);ib_small = (ImageButton)findViewById(R.id.ib_small);ib_small.setOnClickListener(this);ib_mode = (ImageButton)findViewById(R.id.ib_mode);ib_mode.setOnClickListener(this);ib_loc = (ImageButton)findViewById(R.id.ib_loc);ib_loc.setOnClickListener(this);ib_traffic = (ImageButton)findViewById(R.id.ib_traffic);ib_traffic.setOnClickListener(this);ib_marker = (ImageButton)findViewById(R.id.ib_marker);ib_marker.setOnClickListener(this);rl_marker = (RelativeLayout)findViewById(R.id.rl_marker);}@Overridepublic void onClick(View v) {switch (v.getId()) {case R.id.ib_large:if (zoomLevel < 18) {mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomIn());ib_small.setEnabled(true);} else {showInfo("已经放至最大,可继续滑动操作");ib_large.setEnabled(false);}break;case R.id.ib_small:if (zoomLevel > 6) {mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomOut());ib_large.setEnabled(true);} else {ib_small.setEnabled(false);showInfo("已经缩至最小,可继续滑动操作");}break;case R.id.ib_mode://卫星模式和普通模式if(modeFlag){modeFlag = false;mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);showInfo("开启卫星模式");}else{modeFlag = true;mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);showInfo("开启普通模式");}break;case R.id.ib_loc:isFirstLocation = true;showInfo("返回自己位置");break;case R.id.ib_traffic://是否开启交通图if(mBaiduMap.isTrafficEnabled()){mBaiduMap.setTrafficEnabled(false);ib_traffic.setBackgroundResource(R.drawable.offtraffic);showInfo("关闭实时交通图");}else{mBaiduMap.setTrafficEnabled(true);ib_traffic.setBackgroundResource(R.drawable.ontraffic);showInfo("开启实时交通图");}break;case R.id.ib_marker:if(!showMarker){//显示markershowInfo("显示覆盖物");addOverlay(infos);showMarker = true;ib_marker.setBackgroundResource(R.drawable.ditu4);}else{//关闭显示markershowInfo("关闭覆盖物");mBaiduMap.clear();showMarker = false;ib_marker.setBackgroundResource(R.drawable.ditu3);}break;default:break;}}  //显示markerprivate void addOverlay(List<MarkerInfoUtil> infos) {//清空地图mBaiduMap.clear();//创建marker的显示图标BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.ditu1);LatLng latLng = null;Marker marker;OverlayOptions options;for(MarkerInfoUtil info:infos){//获取经纬度latLng = new LatLng(info.getLatitude(),info.getLongitude());//设置markeroptions = new MarkerOptions().position(latLng)//设置位置.icon(bitmap)//设置图标样式.zIndex(9) // 设置marker所在层级.draggable(true); // 设置手势拖拽;//添加markermarker = (Marker) mBaiduMap.addOverlay(options);//使用marker携带info信息,当点击事件的时候可以通过marker获得info信息Bundle bundle = new Bundle();//info必须实现序列化接口bundle.putSerializable("info", info);marker.setExtraInfo(bundle);}//将地图显示在最后一个marker的位置MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);mBaiduMap.setMapStatus(msu);//添加marker点击事件的监听mBaiduMap.setOnMarkerClickListener(new OnMarkerClickListener() {@Overridepublic boolean onMarkerClick(Marker marker) {//从marker中获取info信息Bundle bundle = marker.getExtraInfo();MarkerInfoUtil infoUtil = (MarkerInfoUtil) bundle.getSerializable("info");//将信息显示在界面上ImageView iv_img = (ImageView)rl_marker.findViewById(R.id.iv_img);iv_img.setBackgroundResource(infoUtil.getImgId());TextView tv_name = (TextView)rl_marker.findViewById(R.id.tv_name);tv_name.setText(infoUtil.getName());TextView tv_description = (TextView)rl_marker.findViewById(R.id.tv_description);tv_description.setText(infoUtil.getDescription());//将布局显示出来rl_marker.setVisibility(View.VISIBLE);//infowindow中的布局TextView tv = new TextView(MainActivity.this);tv.setBackgroundResource(R.drawable.infowindow);tv.setPadding(20, 10, 20, 20);tv.setTextColor(android.graphics.Color.WHITE);tv.setText(infoUtil.getName());tv.setGravity(Gravity.CENTER);bitmapDescriptor = BitmapDescriptorFactory.fromView(tv);//infowindow位置LatLng latLng = new LatLng(infoUtil.getLatitude(), infoUtil.getLongitude());//infowindow点击事件OnInfoWindowClickListener listener = new OnInfoWindowClickListener() {@Overridepublic void onInfoWindowClick() {//隐藏infowindowmBaiduMap.hideInfoWindow();}};//显示infowindowInfoWindow infoWindow = new InfoWindow(bitmapDescriptor, latLng, -47, listener);mBaiduMap.showInfoWindow(infoWindow);return true;}});}//自定义的定位监听private class MyLocationListener implements BDLocationListener{@Overridepublic void onReceiveLocation(BDLocation location) {//将获取的location信息给百度mapMyLocationData data = new MyLocationData.Builder()  .accuracy(location.getRadius())  // 此处设置开发者获取到的方向信息,顺时针0-360  .direction(mLastX).latitude(location.getLatitude())  .longitude(location.getLongitude()).build();mBaiduMap.setMyLocationData(data);//更新经纬度mLatitude = location.getLatitude();mLongitude = location.getLongitude();//配置定位图层显示方式,使用自己的定位图标MyLocationConfiguration configuration = new MyLocationConfiguration(LocationMode.NORMAL, true, bitmapDescriptor);mBaiduMap.setMyLocationConfigeration(configuration);if(isFirstLocation){//获取经纬度LatLng ll = new LatLng(location.getLatitude(),location.getLongitude());MapStatusUpdate status = MapStatusUpdateFactory.newLatLng(ll);//mBaiduMap.setMapStatus(status);//直接到中间mBaiduMap.animateMapStatus(status);//动画的方式到中间isFirstLocation = false;showInfo("位置:" + location.getAddrStr());}}}@Overrideprotected void onStart() {super.onStart();//开启定位mBaiduMap.setMyLocationEnabled(true);if(!mLocationClient.isStarted()){mLocationClient.start();}//开启方向传感器myOrientationListener.start();}@Overrideprotected void onStop() {super.onStop();//关闭定位mBaiduMap.setMyLocationEnabled(false);if(mLocationClient.isStarted()){mLocationClient.stop();}//关闭方向传感器myOrientationListener.stop();}@Override  protected void onDestroy() {  super.onDestroy();  //在activity执行onDestroy时执行mMapView.onDestroy(),实现地图生命周期管理  mMapView.onDestroy();  }  @Override  protected void onResume() {  super.onResume();  //在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理  mMapView.onResume();  }  @Override  protected void onPause() {  super.onPause();  //在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理  mMapView.onPause();  }//显示消息private void showInfo(String str){Toast.makeText(MainActivity.this, str, Toast.LENGTH_SHORT).show();}
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396

android 百度地图系列之添加覆盖物和覆盖物的点击事件相关推荐

  1. android列表项点击事件,Android 开发 tips(2):监听 Listview 列表项点击事件

    Android 开发 tips(2):监听 Listview 列表项点击事件 (这篇和上篇本来是应该一起写的,但是太过冗长,附链接:[SimpleAdapter 在 Listview 中的应用] ht ...

  2. 安卓java浮层不响应点击事件,Android悬浮窗屏蔽悬浮窗外部所有的点击事件的实例代码...

    Android可以在所有应用上方添加View,就是给WindowManager添加一个View,在创建的View的时候可以给这个View设置LayoutParams(android.view.Wind ...

  3. python button使用方法_python 批量添加的button 使用同一点击事件的方法

    python 批量添加的button 使用同一点击事件根据传递的参数进行区分. def clear_text(): print '我只是个清空而已' def clear_text(index): pr ...

  4. Android通过MotionEvent仿真手指在屏幕单次点击事件

    Android通过MotionEvent仿真手指在屏幕单次点击事件 Android的View有一个方法performClick(),可人工模拟用户在手机屏幕上的点击事件,这次换一种方法,通过代码制造M ...

  5. Android DataBinding 入门了解 到实现一个buttton的点击事件

    为了更好的学习mvvm 这里从新学习databinding.... 1 首先在app下面的Gradle 里面的android 里面 添加 dataBinding {enabled = true} 如下 ...

  6. android 项目学习随笔十三(ListView实现ITEM点击事件,将已读状态持久化到本地)...

    1.因为给LISTVIEW增加了两个头布局,所以在点击事件ITEM索引会增加2,比如原来第一条数据的索引应该为0,增加两个头布局后,它的索引变为        2,为了使LISTVIEW的ITEM在点 ...

  7. uniapp 地图画圆,和添加遮罩物,遮罩物点击事件

    @markertap 遮罩物点击事件,遮罩物必须有id highAccuracyExpireTime 定位刷新时间,默认10000毫秒; markers 遮罩物列表 circles 圆形列表 < ...

  8. android点击事件注册方式,Android界面控件(3)— 注册同一个点击事件的监听器...

    2019独角兽企业重金招聘Python工程师标准>>> CheckBox 和 RadioButton 1.添加控件 .xml代码如下: CheckBox是同时可以选择多个选项的控件 ...

  9. android 机顶盒 view 焦点,AndroidTV/机顶盒 ListView获取焦点与点击事件问题处理方案...

    AndroidTV/机顶盒 ListView获取焦点与点击事件问题处理方案 本人大二,最近在写一个Android机顶盒的小项目,遇到了这样一个问题.由于App的布局复杂,导致ListView用遥控器获 ...

最新文章

  1. 使用 HttpServerUtility.Transfer 方法在同一应用程序的页面间重定向
  2. 论文作者串通抱团、威胁审稿人,ACM Fellow炮轰「同行评审」作弊
  3. Python3 数字转换为字符串str()函数
  4. 七天开发安卓软件(五)
  5. 回调java 简书_web3j函数回调使用详解
  6. 手把手教你用7行代码实现微信聊天机器人 -- Python wxpy
  7. about-ie下模拟input file上传功能失效
  8. Linux Shell 编程实战技巧
  9. 用 git 维护 vim 代码
  10. 计算机原理与技术索引的应用,经常学一点计算机底层原理系列之索引
  11. Hadoop入门进阶步步高(四)-测试Hadoop
  12. 一篇文章总结暴力破解方法大全
  13. 一文搞懂 CPU、GPU 和 TPU
  14. 零基础学python书籍-非IT行业,零基础自学Python,选什么书?
  15. Android SDK4.0(api14)安装
  16. 中国医科大学计算机学院,中国医科大学是一个什么水平的大学?
  17. Apache配置文件中的deny和allow的使用
  18. 计算机中文件夹属性有哪些,文件和文件夹属性
  19. 微信公众号里的文章图片应该如何原图下载
  20. 浏览器对HTML5中track标签中src属性路径vtt文件错误,Unsafe attempt to load URL vtt

热门文章

  1. 黎曼流形(Riemannian manifold)
  2. 高等数学笔记:留数法
  3. gazebo plugins
  4. 常用电子元器件应用要点及识别方法,知识点很专业!
  5. centos 更新时间
  6. python关于q检验
  7. DELL r340服务器U盘安装Centos7
  8. Cadence 简易使用教程
  9. java 通过 ip地址 找到 打印机_有没有办法使用java套接字程序找到打印机状态?...
  10. Graph WaveNet:用于时空图建模的图神经网络结构