我知道类似的问题已经得到解答,但我似乎已经完成了教程建议并阅读了其他帖子的内容,但我仍然收到 Inflator 错误。不知道我做错了什么。我没有看到谷歌地图。请检查代码。非常感谢。
我生成我的密钥:
keytool -list -v -keystore mystore.keystore
Activity_Map.java
package pt.example.project;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class Activity_Map extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.filexml);
}
}
文件xml.xml
<?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"/>
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pt.example.project"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<!-- START COPY DEV GOOGLE DOCS -->
<permission
android:name="pt.example.project.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="pt.example.project.permission.MAPS_RECEIVE" />
<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" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- END COPY DEV GOOGLE DOCS -->
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/generalnotitle" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="pt.example.project.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="pt.example.project.Activity_Mapa"
android:label="@string/title_activity__mapa"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My KEY" />
</application>