user1391058
user1391058

Reputation: 265

Admob set position?

I added admob adds in my game without xml.and I wanna set position where I want.It's only get some positions like Gravity.TOP or Gravity.BOTTOM and so on... How can i set it with coordinates I want?

Upvotes: 0

Views: 1792

Answers (1)

Dhruvil Patel
Dhruvil Patel

Reputation: 2930

mAdView = new AdView(this, AdSize.BANNER, "ZZZZZ");
FrameLayout fl = (FrameLayout)findViewById(R.id.fl1);
layout.addView(mAdView);

FrameLayout.LayoutParams params =new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT, android.view.Gravity.BOTTOM|android.view.Gravity.CENTER_HORIZONTAL);


layout.addView(mAdView,Params );
mAdView.loadAd(new AdRequest());

try this.

Upvotes: 1

Related Questions