一、简介
二、代码
1.xml
(1)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="0pkT0EYxPi2VZ5beDaJ0g08aCtWGmKTFnOvj6iw"
/>
</LinearLayout>
(2)AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
2.java
(1)MainActivity.java
package com.se7en; import android.os.Bundle; import com.google.android.maps.MapActivity;
import com.se7en.R; /**
* 注意要在AndroidManifest.xml文件中添加库及权限设置
* @author se7en
*
*/
public class MainActivity 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;
} }