开发者

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.BANN开发者_开发百科ER, "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());


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.


You can also use

mAdView.setX([float x]);
mAdView.sety([float y]);

to set the position of Your ads.


adView = new AdView(Cocos2dxActivity.this, AdSize.SMART_BANNER, "mediationId");
adView.setGravity(Gravity.BOTTOM);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜