需要緊急幫助 - 在使用以前的Maps API時 - 在插入以下Maps v2 API的代碼段後,地圖不會加載。 CustomMapView是繼承MapView的Java類。不能理解所有參數應該被替換或刪除嗎?Google Maps APIv2 - 無法加載地圖
<com.stub.android.ui.CustomMapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:clickable="true"
android:apiKey="0xxxxxxxxxxxxxxxxxxxxx" />
伊夫加在清單如下 -
<permission
android:name="com.stub.android.ui.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="com.stub.android.ui.permission.MAPS_RECEIVE" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIxxxxxxxxxxxxxxx" />
代碼爲CustomMapView類
public class CustomMapView extends MapView {
public CustomMapView(Context context, String apiKey) {
super(context, apiKey);
// this.context = context;
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
try {
return super.dispatchTouchEvent(ev);
} catch (Exception ex) {
int zoomLevel = getZoomLevel();
getController().setZoom(zoomLevel-1);
super.setVisibility(View.GONE);
super.setVisibility(View.VISIBLE);
}
return true;
}
@Override
public void draw(Canvas canvas) {
try {
super.draw(canvas);
} catch (Exception e) {
int zoomLevel = getZoomLevel();
getController().setZoom(zoomLevel-1);
super.setVisibility(View.GONE);
super.setVisibility(View.VISIBLE);
}
}
public CustomMapView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// this.context = context;
}
public CustomMapView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
System.gc();
return super.onTouchEvent(ev);
}}
我想了解在XML佈局中所做的更改,而不是清單 – Droido