我有布局结构:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.ads.AdView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
/>
<LinearLayout style="@style/TitleBar"
android:layout_width="fill_parent"
android:layout_height="45dip"
// title bar
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
// main layout with all needed elements and background!" >
</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
一切都很好,直到我的AdMob消失.然后我可以看到具有admob大小的空黑区域.
更新:我的屏幕截图:

通常我会看到这里的广告块,但是当我获得onFailedToReceiveAd(广告请求成功,但由于缺少广告资源而没有广告返回.)广告消费者和我的布局没有填满所有屏幕.
您所描述的内容看起来很奇怪...我认为导致广告消失的原因是广告被刷新,然后由于AdMob方面缺少广告而没有投放广告.但是,根据我自己的测试,一旦广告加载,如果后续广告刷新失败,之前的广告仍然显示,我还没有看到广告'消失'.
也许你可以看看logcat,看看你是否有任何错误.
以下是我用于在自己的应用上测试广告请求传送/失败的一些代码.如果在广告加载失败后出现空白,我想您可以在onFailedToReceiveAd中放置一些代码来调整AdView的大小
AdView av = (AdView)findViewById(R.id.adView);
// Set AdListener
av.setAdListener(new AdListener() {
AdView av = (AdView)findViewById(R.id.adView);
@Override
public void onFailedToReceiveAd(Ad ad, ErrorCode error) {
System.err.println("Ad failed: " + ad.toString() + error.toString());
av.setVisibility(AdView.GONE);//By setting visibility to GONE, you hide the AdView, but the AdView won't refresh automaticaly anymore.
}
@Override
public void onReceiveAd(Ad ad) {
System.out.println("Ad received: " + ad.toString());
av.setVisibility(AdView.VISIBLE);
}
});
// Create an ad request.
AdRequest adRequest = new AdRequest();
// Start loading the ad in the background.
av.loadAd(adRequest);
Run Code Online (Sandbox Code Playgroud)