我正在使用IntelliJ IDEA 9(9.0.1)创建一个简单的地图应用程序(或至少尝试)。 我在Google API 2.0中使用Android 2.0。Android 2.0 SDK地图不显示
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".disaster"/>
<activity android:name=".map" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"/>
<uses-library android:name="com.google.android.maps" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>
类:
查看:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/wall"
>
<View android:id="@+id/mv"
class="com.google.android.maps.MapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:apiKey="08zxVQUd22SOeAuv8AEMS5hBAeOdll4OzDrNYpQ"/>
<Button android:id="@+id/backBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/backBtn"/>
</LinearLayout>
这只是给了我一个空白屏幕。
我在做什么错了?
编辑:澄清我的OP。
你好,谢谢你的思考。 我已经设置了android.permission.INTERNET,现在即使只显示地图也不行,更不用说使用手机的GPS位置了。所以我第一次试图让前者工作。 – user211992 2010-02-06 18:16:52
你可以更新你的OP与您的活动,也许你的地图xml的完整布局? 你也需要在你的mapview中设置一个id(你给的com.google.android.maps.MapView例子没有,你需要从你的活动中引用它) – ccheneson 2010-02-06 18:39:34
我已经更新了我的开始帖子,希望现在更清楚。 地图是我从应用程序菜单调用的视图。(以及我打电话给开始视图的地图类) – user211992 2010-02-06 20:08:42