首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

googlemap的容易使用

2012-07-15 
googlemap的简单使用1. Google提供了一组API,可以很方便的在应用程序当中添加基于地图的功能。2. Android将

googlemap的简单使用

1. Google提供了一组API,可以很方便的在应用程序当中添加基于地图的功能。

2. Android将大部分的地图功能封装在MapView当中

3. MapView将通过GooleMaps服务取得数据,并以地图的方式显示出来

4. MapView提供了一组控件用于地图的控制

?

关于应用程序的签名:

googlemap的容易使用

http://code.google.com/intl/zh-CN/android/add-ons/google-apis/mapkey.htm

如何获取认证指纹:

首先进入Dos界面:

C:\Users\lilin>cd .android

C:\Users\lilin\.android>keytool -list -alias androiddebugkey -keystore debug.key

store

输入keystore密码:android

androiddebugkey, 2011-6-9, PrivateKeyEntry,

认证指纹 (MD5): 68:59:3F:16:27:2B:E5:12:D2:21:FE:6B:6E:0E:C0:27

C:\Users\lilin\.android>

打开网站:http://code.google.com/intl/zh-CN/android/add-ons/google-apis/maps-api-signup.html

获得如下界面:

googlemap的容易使用

?

Main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

??? android:orientation="vertical"

android:layout_width="fill_parent"

??? android:layout_height="fill_parent">

??? <com.google.android.maps.MapView

??? android:layout_width="fill_parent" android:layout_height="fill_parent"

??? android:enabled="true" android:clickable="true"

??? android:apiKey="0gMFVZaryO4oqMq1rim3nkjEir2FBaZyhwMOrAQ" />

</LinearLayout>

Activity

public class goolemaps extends MapActivity {

??? /** Called when the activity is first created. */

??? @Override

??? public void onCreate(Bundle savedInstanceState) {

??????? super.onCreate(savedInstanceState);

??????? setContentView(R.layout.main);

??? }

?

??? @Override

??? protected boolean isRouteDisplayed() {

?????? // TODO Auto-generated method stub

?????? return false;

??? }

}

AndroidManifest.xml

注意:黄色标注的必须添加的,否则出错!

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

??? package="com.epoint.goolemaps" android:versionCode="1"

??? android:versionName="1.0">

??? <uses-sdk android:minSdkVersion="8" />

??????? <application android:icon="@drawable/icon" android:label="@string/app_name">

?????? <uses-library android:name="com.google.android.maps" />

?????? <activity android:name=".goolemaps" android:label="@string/app_name">

?????????? <intent-filter>

????????????? <action android:name="android.intent.action.MAIN" />

????????????? <category android:name="android.intent.category.LAUNCHER" />

?????????? </intent-filter>

?????? </activity>

??? </application>

??? <uses-permission android:name="android.permission.INTERNET" />

</manifest>

热点排行