歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Android--MapView.第一個簡單的MapView

Android--MapView.第一個簡單的MapView

日期:2017/3/1 10:01:36   编辑:Linux編程

Android--MapView.第一個簡單的MapView

1.新建一個類,繼承MapActivity類,選擇Google APIs

2.在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>

Copyright © Linux教程網 All Rights Reserved