我正在尝试显示一个简单的地图。
这就是我所拥有的:
package com.chance.squat;
import com.chance.squat.R;
import com.google.android.maps.MapActivity;
import android.os.Bundle;
public class Maps extends MapActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.maps);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="A2:D9:A5:1C:21:6F:D7:44:47:23:31:EC:1A:98:EF:36"
/>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chance.squat"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/CustomTheme">
<uses-library android:name="com.google.android.maps"/>
<activity android:name=".MyApp"
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.chance.squat.Search"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="com.chance.squat.Add"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="com.chance.squat.About"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
我还下载了版本8的Google API,并已设置针对它们进行构建。我的问题是它似乎没有找到导入com.google.android.maps.MapActivity,我不知道为什么或下一步是什么。
答案 0 :(得分:1)
地图应该在清单中
<activity android:name="com.chance.squat.Maps"
android:label="@string/app_name">
...
</activity>