Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Advertising Service

Reply
Developer
Posts: 83
Registered: ‎02-03-2009
My Device: 9500/9520/9800/9810
My Carrier: TMobile
Accepted Solution

Width of Banner-Field - option to center the add on the screen?

I have added the banner just on the top of the page - and I am using/testing on a Storm2 - I notice two things:

 

1) the field/banner is not using the complete screen width [especially in landscape mode]

 

2) the field/banner is not centered and I do not see any way in the banner constructor to pass any long values to make use of FIELD constances

 

Even if for the moment I do not gat anyhow any add content (which will for sure aprear quite soon - I am confident about that) I can see from the "fade in" section, that not the complete screen width will be used.

 

Any suggestions to center the banner display somehow?

[FileScout] | [iMazing] | [GPSLogger II] | [Iconify] | [TOMPlayer]
Developer
Posts: 176
Registered: ‎11-06-2008
My Device: Not Specified

Re: Width of Banner-Field - option to center the add on the screen?

The sizes are not auto expanding so it's not going to fill the width, the sizes are listed in the docs

http://docs.blackberry.com/en/developers/deliverables/16807/Setting_the_size_of_the_disp_area_for_an...

 

Check the docs

http://docs.blackberry.com/en/developers/deliverables/16807/Position_the_disp_area_for_an_ad_1177318...

there's info on centering

Highlighted
Retired
Posts: 1
Registered: ‎10-08-2010
My Device: Not Specified

Re: Width of Banner-Field - option to center the add on the screen?

Try using this code to center it in your screen

 

VerticalFieldManager containerVfm = new VerticalFieldManager(VerticalFieldManager.NO_VERTICAL_SCROLL | VerticalFieldManager.NO_VERTICAL_SCROLLBAR |VerticalFieldManager.USE_ALL_WIDTH);

 HorizontalFieldManager containerHfm = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_VCENTER);

 Banner banner = new Banner(placement_id, null);

 containerHfm.add(banner);

 containerVfm.add(containerHfm);

 add(containerVfm);