本文介绍了Android的地图是纯白色的屏幕上 - 没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XML(activity_maptest.xml):

XML (activity_maptest.xml):

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:name="com.google.android.gms.maps.MapFragment"/>

爪哇(Maptest.java):

Java (Maptest.java):

package com.example.app;

import android.app.Activity;
import android.os.Bundle;

public class Maptest extends Activity {

    public class MapActivity extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_maptest);
        }
    }

}

清单:

<uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    .
    .
    .
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
<application
        android:allowBackup="true"
        android:icon="@drawable/icon_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat.Light.DarkActionBar" >
        .
        .
        .
        <activity
            android:name="com.example.app.Maptest"
            android:label="@string/title_activity_maptest" >
        </activity>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="MY ACTUAL KEY" />
    </application>

当这个页面在我的网页加载只是白色的,有没有错误LogCat中。我是继谷歌指南:,但它似乎我做错了什么事?

When this page is loaded in my page is just white and there are no errors LogCat. I was following the google guide: https://developers.google.com/maps/documentation/android/start, but it appears I did something wrong?

推荐答案

您有一个活动内的活动。请尝试删除其中的一个

You have an Activity inside an Activity. Try removing one of them

这篇关于Android的地图是纯白色的屏幕上 - 没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 21:19