Displaying admob banner at the bottom of the screen
Posted: Mon Oct 05, 2015 4:51 pm
Hi. I want to display an admob banner at the bottom of the screen.
Here is the code in GameActivity.java.
My banner displays at the top of the screen, instead of displaying at the bottom.
My game is in portrait mode.
Any help is appreciated. Thanks.
Here is the code in GameActivity.java.
My banner displays at the top of the screen, instead of displaying at the bottom.
My game is in portrait mode.
Code: Select all
adView = new AdView(mSingleton);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId("ca-app-pub-XXXXXXXXXXXXXXXXX/XXXXXXXXX");
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); //<--- I modified only this line, originally it was: params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXX")
.build();
adView.loadAd(adRequest);
mLayout.addView(adView, params);