我正在使用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