Align admob ad to right and bottom of screen

727 views
Skip to first unread message

Gautam Chaudhary

unread,
Dec 9, 2011, 8:26:39 AM12/9/11
to google-adm...@googlegroups.com
Hi,

I'm building an android app with phonegap and displaying admob ads by creating adview with following code:

        adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxxx");
        this.appView.addView(adView);
        adView.loadAd(new AdRequest());

I want to align this ad to right of the screen in one app and bottom in another app, and it should remain fixed and not scroll. There are many code example on how to do this in the main.xml file, but i cannot use that method as phonegap doesn't allow to modify view through that.  How can i make the re position the ad by modifying the above code?

Thanks.

kunal verma

unread,
Dec 9, 2011, 12:50:05 PM12/9/11
to google-adm...@googlegroups.com
For aligning your ad to the bottom and not scrolling it , you will
have to use your main layout as relative layout
Refer to this: http://developer.android.com/reference/android/widget/RelativeLayout.html
Use align parent bottom to make it to the bottom
Reply all
Reply to author
Forward
0 new messages