Android Map是纯白色屏幕-没有错误
作者:互联网
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"/>
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没有错误.我正在遵循Google指南:https://developers.google.com/maps/documentation/android/start,但看来我做错了什么?
解决方法:
您在活动中有一个活动.尝试删除其中之一
标签:android,google-maps,android-mapview 来源: https://codeday.me/bug/20191013/1905143.html