在我的应用程序中,我正在显示带有指针的 Google 地图。我已经提交了应用程序,market
并通过从市场下载进行了检查。
默认地图显示在混合视图中。通常地图看起来不错,但是当我尝试放大地图时显示一个空白背景,如下图所示
以下是我的地图代码:
class MapOverlay extends com.google.android.maps.Overlay {
public boolean draw(Canvas canvas, MapView mapView,boolean shadow, long when) {
super.draw(canvas, mapView, shadow);
Point screenPts = new Point();
mapView.getProjection().toPixels(p, screenPts);
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pin);
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-100, null);
return true;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
Map = (ImageButton)findViewById(R.id.MapBtn);
Hybrid = (ImageButton)findViewById(R.id.hybridBtn);
mapView = (MapView) findViewById(R.id.mapView);
mapView.setSatellite(true);
mapController = mapView.getController();
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.getProvider(LocationManager.GPS_PROVIDER);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
String bestProvider = locationManager.getBestProvider(criteria, true);
p = new GeoPoint((int) (latPt * 1E6),(int) (lngPt * 1E6));
mapController.animateTo(p);
mapController.setZoom(16);
mapView.invalidate();
mapView.setTraffic(true);
mapController = mapView.getController();
MapOverlay mapOverlay = new MapOverlay();
List<Overlay> listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);
}
显现:
<manifest xmlns:android="schemas.android.com/apk/res/android";
package="com.app.ig.sap"
android:versionCode="2"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
<uses-feature android:name="android.hardware.camera"/>
<application
android:icon="@drawable/q_icon"
android:theme="@android:style/Theme.Light"
android:label="@string/app_name"
android:debuggable="false">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".SplashScreen">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
谁能解释一下为什么地图放大后看起来像这样?