为了适应adMob出现时的所有布局,我试图获得它的高度但没有成功,高度总是= 0!如何到达?谢谢你。
/** Called when an ad is received. */
@Override
public void onReceiveAd(Ad ad)
{
adView.setVisibility(View.VISIBLE);
final android.view.ViewTreeObserver obs = adView.getViewTreeObserver();
obs.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw () {
int height = adView.getHeight();
return true;
}
});