AdMob mediated Millenial Media ad taking entire screen on refresh

放肆的年华 提交于 2019-12-11 10:04:08

问题


I've already got AdMob mediation in place, and I'm in the process of adding Millennial Media to it. My ads are added using XML like this:

<RelativeLayout
    android:id="@+id/adContainer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:gravity="center_horizontal"
    android:orientation="vertical" >

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="xxx"
        android:gravity="center_horizontal"
        android:visibility="gone" />
</RelativeLayout>

It is gone by default, but shown by code if user is not a paying user. The ads refresh regularly using a time set in AdMob account website.

Millennial Media ads appear as intended if they are chosen as the first ad, but if the ad refreshes and Millennial Media is chosen to serve the ad it takes the entire screen as seen below:

I've read some information that said something about Millennial Media ads requiring specific sizing, but as I'm not insering their ad with their code, I'm not sure how to handle this. Also, since I'm serving from several sourced I'd like not to hard code in the width/height.

How can I keep it correctly sized?


回答1:


It doesn't look like the AdView is suddenly taking more space. It looks like the View above the AdView is suddenly taking less.

Review your full layout. Something should specify android:layout_height="match_parent" where the parent is root View.



来源:https://stackoverflow.com/questions/25298333/admob-mediated-millenial-media-ad-taking-entire-screen-on-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!