ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
495 stars 211 forks source link

Banner Position and size #191

Open DesignerApparelSales opened 6 years ago

DesignerApparelSales commented 6 years ago

Hi how do I set the size to be fixed 320 X 50, and position the banner to be at top-right corner, like this in admob pro.

if(AdMob) AdMob.createBanner( {

adSize: 'CUSTOM', // banner type size
width: 320, // banner width, if set adSize to 'CUSTOM'
height: 50, // banner height, if set adSize to 'CUSTOM'
position:AdMob.AD_POSITION.TOP_RIGHT, 

} );
iONinja commented 6 years ago

I'm having this problem too. I need it in a specific position.

ghost commented 6 years ago

Try to use: { size: 'BANNER', bannerAtTop: true, offsetTopBar: true }

https://ratson.github.io/cordova-plugin-admob-free/typedef/index.html#static-typedef-BANNER_SIZE

iONinja commented 6 years ago

@condacore This won't put it in the top right. There is currently no option to position left/right in this plugin, although I've achieved it by editing the source code.

sonugpc commented 5 years ago

@condacore This won't put it in the top right. There is currently no option to position left/right in this plugin, although I've achieved it by editing the source code.

Can You Share What Changes you have made to achive this ?

iONinja commented 5 years ago

@sonugpc I inserted the following code at line 195 of /src/android/banner/BannerExecutor.java:

params2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

Hope this helps!