Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place an Admob ads bottom center of the screen?(Using java code to place.)

I used this code to place my admob ads, but these code will show the ads on top left of the screen, How to place the ads bottom center of the screen? please help :)

mAdView = new AdView(this, AdSize.BANNER, "xxxxx");
FrameLayout layout = (FrameLayout)findViewById(R.id.game_layout);
layout.addView(mAdView);
FrameLayout.LayoutParams adsParams = new FrameLayout.LayoutParams(LayoutParams.);
mAdView.setGravity(Gravity.BOTTOM);
mAdView.loadAd(new AdRequest());
like image 758
pixeloverflow Avatar asked Dec 16 '22 15:12

pixeloverflow


1 Answers

The Height and Width layout Params for the FrameLayout should be FILL_PARENT. By Default it consider the height layout Param as WRAP_CONTENT and because of that even you have set the GRAVITY to BOTTOM your ads displayed on TOP. SET the Layout Params as I said.

like image 108
Rahul Patel Avatar answered Apr 20 '23 00:04

Rahul Patel