0

非常に基本的な Google マップ API コードを試しています。しかし、それは私に空白の青いページを与えるだけです.

私のプログラムはこれです

Java コード::

package com.project1;

import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class Testmap22Activity extends MapActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        MapView mapview = (MapView) findViewById(R.id.mapview);
        GeoPoint gp = new GeoPoint(130810,802740);
        MapController mvc = mapview.getController();
        mvc.setCenter(gp);
        mapview.setBuiltInZoomControls(true);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

main.xml は

<?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:enabled="true"
                 android:clickable="true"
                 android:apiKey="Key"
                 />

マニフェスト ファイル

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.project1"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="15" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.INTERNET"/>


    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".Testmap22Activity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <uses-library android:name="com.google.android.maps"/>
    </application>

</manifest>

表示されるのは、Zoom が有効になっている空白の青いページだけです。これについてあなたの助けが必要です...

サブブ

4

3 に答える 3

1
 android:apiKey="Key"

代わりに MD5 (マップ キー) を挿入します"Key"

MD5 の入手方法https://developers.google.com/maps/documentation/android/mapkey

于 2012-05-28T13:13:00.510 に答える
0

間違いはここ

 android:apiKey="Key"

このリンクを参照してください..ここでマップビューが段階的に説明されてい ます http://developer.android.com/resources/tutorials/views/hello-mapview.html

于 2012-05-28T13:22:02.420 に答える
0

あなたが言ったように、正しいマップ キーを入力し、ビルド ターゲットは既に Google Api に設定されています。次に、このブルー スクリーンの可能性は 1 つだけです (緯度と経度の引数が間違っている)。

           GeoPoint gp = new GeoPoint(130810,802740);

画面が青く表示されるのは、GeoPoint コンストラクターで間違った引数を指定したためです。GeoPoint コンストラクターで正しい緯度と経度を渡します。

于 2012-09-20T10:42:04.930 に答える