Re: Setting the adSize attribute in DoubleClick (DFP) via XML

455 views
Skip to first unread message

Eric Leichtenschlag

unread,
Jul 27, 2012, 12:52:33 PM7/27/12
to google-adm...@googlegroups.com
Hi Joel,

Unfortunately, the adSize parameter only accepts banner size constants like BANNER, IAB_MRECT, etc.  You'll have to create the AdView in code to set custom ad sizes.

Eric


On Mon, Jul 23, 2012 at 12:30 PM, Joel Martinez <efan...@about-inc.com> wrote:
Working off of the guidelines for DoubleClick for publishers, I'm trying to use the ad unit id and ad size generated by the tag generate function. However, the suggested implementation is manually instantiating the AdView, but I'm using XML to define the ad view, and the supplied adSize value isn't working:

        <com.google.ads.AdView android:id="@+id/adView"
                       android:layout_width="match_parent"
                       android:layout_height="wrap_content"

                       android:layout_alignParentBottom="true"
                       ads:adUnitId="/networkCode/adUnitName"
                       ads:adSize="(230, 50)"
                       />

Unfortunately, that shows the error "Invalid "adSize" value in XML layout: (230, 50)" on the screen. I tried several other formats, like "230, 50", and "230x50" but it was the same result every time ... only using "BANNER" seems to work.

Any thoughts would be appreciated, thanks!

--
 
 
 



Miri Lee

unread,
Jul 30, 2012, 3:24:26 AM7/30/12
to google-adm...@googlegroups.com
Hi Joel,

Take a look at the Custom Ad Size section of the DoubleClick banner page. 

Thanks,
Miri

--
 
 
 

Eric Leichtenschlag

unread,
May 22, 2013, 6:09:03 PM5/22/13
to google-adm...@googlegroups.com
We don't have support for multiple ad sizes via XML. I've field a feature request for this, but I think it's pretty low priority. You can set multiple ad sizes in code via the overloaded DfpAdView constructor. And you'll have to do some setup in code if you want to listen for changes in the banner size anyways.

Thanks,
Eric

On Friday, May 17, 2013 4:16:42 AM UTC-7, Kostadin Moraliev wrote:
Hi,
What about set multiple ad sizes in XML?

Eric Leichtenschlag

unread,
Jun 6, 2013, 10:45:17 AM6/6/13
to google-adm...@googlegroups.com
Correction - this is actually already supported with SDK v6.4.1. You can put:

    <com.google.ads.doubleclick.DfpAdView android:id="@+id/adView"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     ads:adUnitId="YOUR_AD_UNIT_ID"
     ads:adSize="320x50,IAB_MRECT,120x20"
     ads:loadAdOnCreate="true"/>

into XML, and it will create a multiple sized AdView with 320x50, 300x250, and 120x20.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages