Halvor Holsten Strand
Halvor Holsten Strand

Reputation: 20536

AdMob mediated Millenial Media ad taking entire screen on refresh

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:

enter image description here Millennial Media full screen error

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?

Upvotes: 1

Views: 393

Answers (1)

William
William

Reputation: 20196

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.

Upvotes: 0

Related Questions