谷歌地图android v2白屏 - 不是所有设备

时间:2013-03-28 11:19:06

标签: android google-maps

我知道有一些问题,但他们都没有帮助我。

我正在使用Sony Xperia(API 14)进行调试,我总是会看到带有缩放按钮(+和 - )的白色屏幕。但是我用Galaxy Nexus测试了相同的代码,我可以看到地图。

如果它在另一台设备上工作但在我的设备中没有,我想这不是API密钥问题,权限问题,布局或代码问题。我也检查过GooglePlayServices,并且总是返回SUCCEED。

这是布局代码:

<?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>

这是java代码:

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();
    }

}

我有很多进口,因为我已经尝试了一切。但现在我知道问题出在设备上,而不是代码上。

有什么想法吗?

0 个答案:

没有答案