谷歌地图android v2白屏-并非所有设备
我知道这方面有一些问题,但没有一个对我有帮助 我正在用Sony Xperia(API 14)进行调试,我总是得到一个带有缩放按钮(+和-)的白色屏幕。但我已经用Galaxy Nexus测试了相同的代码,我可以看到地图 如果它在另一个设备中工作,但在我的设备中不工作,我想这不是API密钥问题、权限问题、布局或代码问题。我也检查过谷歌的游戏服务,总是能成功返回 这是布局代码:谷歌地图android v2白屏-并非所有设备,android,google-maps,Android,Google Maps,我知道这方面有一些问题,但没有一个对我有帮助 我正在用Sony Xperia(API 14)进行调试,我总是得到一个带有缩放按钮(+和-)的白色屏幕。但我已经用Galaxy Nexus测试了相同的代码,我可以看到地图 如果它在另一个设备中工作,但在我的设备中不工作,我想这不是API密钥问题、权限问题、布局或代码问题。我也检查过谷歌的游戏服务,总是能成功返回 这是布局代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
我有很多进口货,因为我什么都试过了。但现在我知道问题出在设备上,而不是代码上
有什么想法吗?我以前也遇到过类似的问题,就我而言,这是由于设备的日期/时间错误造成的。还要确保你已通过Xperia连接到互联网(对不起,我知道这是一条蹩脚的评论,但只是试图覆盖所有基础)。-解决-我刚刚在设备上安装了SIM卡,现在我收到了Google Play服务错误。似乎你需要有一个数据连接,因为我是通过WiFi连接的,它是“ok”。也许还有另外一种通过wifi获得互联网服务的用户许可。
package com.nanonino.realtor;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.MapFragment;
import android.app.Activity;
import android.app.Dialog;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
public class ByLocation extends Activity {
@Override
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//setContentView(R.layout.by_location_list);
setContentView(R.layout.by_location_map);
//if state has a value different from 0...OH OH!!! Problem, you have
//to tell the user to install GooglePlayService in the device
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
switch (resultCode) {
case ConnectionResult.SUCCESS: // proceed
break;
case ConnectionResult.SERVICE_MISSING:
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
case ConnectionResult.SERVICE_DISABLED:
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 1);
dialog.show();
}
}