我通过点击事件在弹出窗口中生成传单地图,代码如下:
mymap = L.map('mapdiv').setView([center.lat, center.long], zoom);
但是,如果我关闭弹出窗口并再次单击以生成新地图,则会收到错误消息:
地图容器已经初始化
我应该如何第二次生成地图?
答案 0 :(得分:0)
您应该在弹出窗口关闭时销毁地图。请参见 implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.code.gson:gson:2.4'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.makeramen:roundedimageview:2.1.1'
implementation project(':expandablelayout')
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
implementation 'com.timehop.stickyheadersrecyclerview:library:0.4.1@aar'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.26.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.5.0@aar') {
transitive = true;
}
implementation project(':stripe')
//implementation files('libs/PayPalAndroidSDK-2.10.1.jar')
implementation('com.paypal.sdk:paypal-android-sdk:2.16.0') {
exclude group: 'io.card'
}
implementation 'com.facebook.android:account-kit-sdk:4.18.0'
implementation files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'com.appsflyer:af-android-sdk:4.8.11@aar'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.onesignal:OneSignal:3.6.3@aar'
的{{1}}方法。例如
remove()