我正在移植到新的GPS Admob。
我已经覆盖了AdView。
class AdView1 extends AdView{
public AdView1(Activity activity, AdSize adSize, String adUnitId) {
super(activity);
adView.setAdUnitId(adUnitId);
adView.setAdSize(adSize);
}
int bannerHeight;
boolean bannerShown;
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
bannerHeight = h;
if(bannerShown){
SetBannerHeight1(bannerHeight);
}
}
}
但现在AdView
是最终的。
获得AdView高度的最佳方法是什么?
我知道有以下方法 https://developer.android.com/reference/com/google/android/gms/ads/AdView.html#getAdSize() https://developer.android.com/reference/com/google/android/gms/ads/AdSize.html
但我不知道何时才是召唤这些人的最佳时机。
e.g。 https://developer.android.com/reference/com/google/android/gms/ads/AdListener.html#onAdLoaded() 要么 https://developer.android.com/reference/com/google/android/gms/ads/AdListener.html#onAdOpened()