GoogleMap的基本使用

[color=green][b]首先,在配置清单文件中需要 引入
<uses-library android:name="com.google.android.maps"/>
<uses-permission android:name="android.permission.INTERNET"/>
然后在layout布局文件中
可以引用 com.google.android.maps.MapView控件,因为它不是android基本包下, 所以需要加入前缀。
<com.google.android.maps.MapView
android:layout_height="fill_parent"
android:layout_wighth="fill_parent"
android:clockable="true"
android:enabled="true"
android:id="@+id/mapView_display"
android:apiKey="............"
这个ApiKey 需要在现在google中申请一个账号。然后在windows下的preference中的debug中找到keystore 然后启动cmd命令输入keytool -list -alias androiddebugkey -keystore "路径" -storepass android -keypass android
这样就能够拿到md5编码。然后到google上就可以拿到apikey了。
然后继承MapActivity。创建MapView 和MapController
MapController 通过MapView.getController()得到。
MapView.setsatelite()设置卫星云图
MapView.setStreet()设置街道
MapView.setTraffic()设置交通
MapView.setBuiltInZoomControls()设置多点触摸
MapController.animateTo()或者setCenter()的方式 显示指定的坐标
坐标通常是通过 经度和纬度来进行计算的。里面的参数是GeoPoint,在GeoPoint我们需要加入经纬度。
然后就可以调用 GoogleMap了。
[/b][/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值