Android--MapView.第一个简单的MapView


Android--MapView.第一个简单的MapView

1.新建一个类,继承MapActivity类,选择Google APIs

2.在AndroidManifest.xml文件中添加map库和网络访问权限

 

3.main.xml文件,此处的apiKey为你自己申请的key,

如何取得apiKey,请看

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="0LohYR7LZtdkVKy3GnPMW_TOEC4I9zd1xAlwxAQ"
        android:clickable="true" />

</LinearLayout>

  • 1
  • 2
  • 下一页

相关内容