Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / Android--MapView.第一个简单的MapView

Android--MapView.第一个简单的MapView1.新建一个类,继承MapActivity类,选择Google APIs2.在AndroidManifest.xml文件中添加map库和网络访问权限 3.main.xml文件,此处的apiKey为你自己申请的key,如何取得apiKey,请看 http://www.linuxidc.com/Linux/2013-02/79495.htm<?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>