0

モバイル マップ アプリケーションに関する Google チュートリアルを進めています。Android 仮想電話でアプリケーションをコンパイルして実行することができました。

5.4 FWVGA (480x854:mdpi)。

実際に電話でアプリケーションを起動すると、背景が正方形の空のマップが表示されます (ジオメトリ ペーパーのように)。

私の気持ちは、ここで何かが間違っているということです:

res/layout/activity_main.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world" />

</RelativeLayout>

res/layout/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:clickable="true"
    android:apiKey="blablabla"
/>

AndroidManifest.xml:

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <uses-library android:name="com.google.android.maps"/>
        <activity
            android:name=".HelloGoogleMaps" android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
       </activity>
    </application>
</manifest>

明確にするために、アプリケーションをインターネットに接続してタイルをロードするにはどうすればよいですか?

ありがとう

ジェニア

4

3 に答える 3

2

マニフェスト ファイルでインターネット アクセス許可が付与されていることを確認する以外に (これは、新しいアプリケーションの開発を開始するときに忘れがちなものです)、デバッグ目的で特別に作成された MapView オブジェクトの apiKey 属性で使用しているキーです。 ? そうでない場合、MapView を操作することはできますが、タイルを表示することはできません。

于 2012-11-20T21:11:00.640 に答える
1

プロジェクトで参照されているGoogleAPIを持っているが、APIキーを持っていない場合は、ここにアクセスし、このドキュメントを使用して、プロジェクトを使用できるようにする方法を説明してください。

于 2012-11-20T21:53:02.917 に答える
0

このリンクは完全な解決策です:

(pt-br) http://developerai.blogspot.com.br/2012/07/android-development-google-maps.html

忘れないで

 <uses-library android:name="com.google.android.maps" />

高度な開発者で、より優れたアプリが好きな場合は、次のことを学んでください。

https://github.com/cyrilmottier/ポラリス

于 2012-11-20T21:31:32.473 に答える