1.使用googleMap 项目必须使用google APIS
2.必须申请key
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.map);
mapView = (MapView)findViewById(R.id.map);
// 设置显示模式
// mapView.setTraffic(true);
mapView.setSatellite(true);//是否卫星模式
mapView.setStreetView(false);
//设置缩放模式
mapView.setBuiltInZoomControls(true);
GeoPoint geoPoint = new GeoPoint((int)(22.548723*1E6),(int)(113.936591*1E6));
mapCon=mapView.getController();
mapCon.setCenter(geoPoint);
mapCon.setZoom(15);
Projection projection = mapView.getProjection();
//进行画布
List<Overlay> overlays = mapView.getOverlays();
overlays.add(new MyPostionOverlay(projection,geoPoint ));
}
/**
* 主要是画图 将标记位置
* @author Administrator
*
*/
public class MyPostionOverlay extends Overlay {
private Projection projection;
private GeoPoint geoPoint;
public MyPostionOverlay(Projection projection, GeoPoint geoPoint ){
this.projection=projection;
this.geoPoint=geoPoint;
}
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
super.draw(canvas, mapView, shadow);
//准备园图
Point point = new Point();
Paint paint = new Paint();
paint.setColor(Color.RED);
paint.setAntiAlias(true);
paint.setStyle(Style.FILL);
//经度转像素
projection.toPixels(geoPoint, point);
//将图画到上层
canvas.drawCircle(point.x, point.y, 6.0f, paint);
}
布局文件中加入
<com.google.android.maps.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0L96i8AoAKKTN50BsQTVZJDpNM48n34utP2nhTg"/>
android:apiKey是申请的key
不要忘记申请权限和导入mapslib
在application标签中加入
<uses-library android:name="com.google.android.maps"/>
分享到:
相关推荐
Android Google map使用,Android Google map使用
Android google map API例子
实现通过GPS或NetWork获取当前位置的经纬度,并且在Google Map Android v2上显示
android google map 应用。可以显示地图,提供搜索功能,解析地址并定位。
安卓 android google map 谷歌地图
2013年更新的google map api v2致使原来的很多类都不能使用了,本人经过研究和翻看api文档整理并写了这个程序,实现了了位置获取,通过地名获取经纬度,输入目的地进行导航路线获取,异步数据处理等功能
google map for android
申请Android Google Map API key
android google map example
Android结合google map应用开发,路径查询设定,路径导航。
介绍android本地服务类的使用方法,附源码。
压缩包包含play-services-maps-16.1.0.aar/play-services-places-15.0.1.aar/play-services-location-15.0.1.aar/android-maps-utils-0.5.aar 等...
Android googlemap 学习交流
android 客户端使用google-Map实例
android在google map上画导航路线图
Android Google Map 总结 另外附加实例
googleMap根据经纬度获取地理位置,里面有使用代码,只需填入经纬度即可获取地理位置信息
使用ArcGIS for Android开发的加载GoogleMap地图。并判断无网络时自动加载本地图片。图片存放在/ArcGIS/samples/tiledcache/下。在有网络时自动存储地图图片。未做容量控制及清空策略。并集成了从ArcGIS Server缓存...
NULL 博文链接:https://kurting615.iteye.com/blog/1150574
android GoogleMap开发步骤详解,包含代码