0

我在谷歌地图屏幕中遇到问题,它显示空白谷歌地图屏幕包含整个屏幕地图中的瓷砖没有生成

我已经正确完成了所有设置,根据从网上获取相同问题的解决方案,我仍然无法解决问题,请任何人都可以帮助我吗?

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gmaptest5"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="17" />    

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name="com.example.gmaptest5.Gmap5MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

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

  </application>

 <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 <uses-permission     android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

  <uses-feature
  android:glEsVersion="0x00020000"
  android:required="true"/>

 <permission
  android:name="com.example.gmaptest5.permission.MAPS_RECEIVE"
  android:protectionLevel="signature"/>
 <uses-permission android:name="com.example.gmaptest5.permission.MAPS_RECEIVE"/> 

 </manifest>

主.xml

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
 >
 <com.google.android.maps.MapView
     android:id="@+id/mapview1"
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:enabled="true" 
     android:clickable="true" 
  android:apiKey="MY API KEY" />

 </LinearLayout>

主.Java

   public class Gmap5MainActivity extends MapActivity {
private MapView myMapView;
LocationManager locationManager;
private Location myLocation;

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

    myMapView = (MapView)findViewById(R.id.mapview1);
    double lat = 19.7888;
       double longi = 52.535;        

      GeoPoint p = new GeoPoint((int) (lat *1E6),(int) (longi *1E6));
    //GeoPoint p = new GeoPoint((int) (location.getLatitude()* 1000000), (int)  (location.getLatitude()* 1000000));
    MapController mc = myMapView.getController();

    mc.setZoom(18);
    mc.animateTo(p);
    // Enable Sattelite-Mode
    myMapView.setSatellite(true);
    myMapView.getMapCenter();
    myMapView.setBuiltInZoomControls(true);
    myMapView.displayZoomControls(true);
    myMapView.invalidate();   
    myMapView.getOverlays();
    myMapView.getProjection();      
    this.myLocation = new Location("gps");
    this.myLocation.setLongitude(77.52436144125092);
    this.myLocation.setLatitude(13.05096452223662);
    Double lat1 = myLocation.getLatitude();
    Double longi1 = myLocation.getLongitude();
    GeoPoint point = new GeoPoint(lat1.intValue(), longi1.intValue());
    mc.setCenter(point);*/
}
    public boolean onKeyDown(int keyCode, KeyEvent event) 
    {
    if (keyCode == KeyEvent.KEYCODE_I) {
    myMapView.getController().setZoom(myMapView.getZoomLevel() + 1);

    return true;
    } else if (keyCode == KeyEvent.KEYCODE_O) {
    myMapView.getController().setZoom(myMapView.getZoomLevel() - 1);
    return true;
    } else if (keyCode == KeyEvent.KEYCODE_S) {
    myMapView.setSatellite(true);
    return true;
    } else if (keyCode == KeyEvent.KEYCODE_T) {
    myMapView.setSatellite(false);
    myMapView.setTraffic(true);
    return true;
    }
    return false;
    }

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_gmap5_main, menu);
    return true;
}

@Override
protected boolean isRouteDisplayed() {
    return false;
}
  }
4

1 回答 1

0

您正在与 混合Google Map API V1使用API V2,如果您想按照文件Google Map V2的外观使用,Manifest那么您可以查看我写的关于如何向Google map API V2您的应用程序添加的博客文章:

谷歌地图 API V2 安卓

如果您想使用,API V1那么您将不得不更改您的Manifest文件,因为它当前设置为使用API V2,请点击此链接:

https://developers.google.com/maps/documentation/android/v1/hello-mapview

于 2013-03-16T15:34:19.997 回答