我试图在我的Android应用中显示地图,我跟着下面的文章
但活动已开始且地图未显示
以下是我的主要活动
<?xml version="1.0" encoding="utf-8"?>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyACHHKBCSoG5ZEGbNYgMhKWSsZrV3loKek" />
<activity
android:name="com.example.hotel.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.hotel.OptionsActivity"
android:label="@string/title_activity_options"
android:parentActivityName="com.example.Hotel" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.Hotel" />
</activity>
<activity
android:name="com.example.hotel.Reservation"
android:label="@string/title_activity_reservation" >
</activity>
<activity
android:name="com.example.hotel.Reservations_Activity"
android:label="@string/title_activity_reservations_" >
</activity>
<activity
android:name="com.example.hotel.ReservationDetails"
android:label="@string/title_activity_reservation_details" >
</activity>
<activity
android:name="com.example.hotel.SearchByStatus"
android:label="@string/title_activity_search_by_status" >
</activity>
<activity
android:name="com.example.hotel.SearchByHotel"
android:label="@string/title_activity_search_by_hotel" >
</activity>
<activity
android:name="com.example.hotel.ResApplication"
android:label="@string/title_activity_res_application" >
</activity>
<activity
android:name="com.example.hotel.Map"
android:label="@string/title_activity_map" >
</activity>
</application>
这是活动代码
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>