Commit a77bbcce authored by wanglei's avatar wanglei

...

parent 360dc0b7
...@@ -28,17 +28,17 @@ object AdmobBannerUtils { ...@@ -28,17 +28,17 @@ object AdmobBannerUtils {
if (isShowBanner == 0 && !BuildConfig.DEBUG) { if (isShowBanner == 0 && !BuildConfig.DEBUG) {
return return
} }
if (adView != null) { adView?.destroy()
adView?.destroy() adView = null
}
adView = AdView(context) adView = AdView(context)
// parent.removeAllViews() parent.removeAllViews()
val list = parent.children // val list = parent.children
list.forEach { // list.forEach {
if (it.tag != "zhanweitu") { // if (it.tag != "zhanweitu") {
parent.removeView(it) // parent.removeView(it)
} // }
} // }
parent.addView(adView) parent.addView(adView)
listener = ViewTreeObserver.OnGlobalLayoutListener { listener = ViewTreeObserver.OnGlobalLayoutListener {
val screenPixelDensity = context.resources.displayMetrics.density val screenPixelDensity = context.resources.displayMetrics.density
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment