📜  必须在调用 loadad 之前设置广告尺寸和广告单元 ID - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:59.642000             🧑  作者: Mango

代码示例1
View adContainer = findViewById(R.id.adMobView);

AdView mAdView = new AdView(context);
mAdView.setAdSize(AdSize.BANNER);
mAdView.setAdUnitId(YOUR_BANNER_ID);
((RelativeLayout)adContainer).addView(mAdView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);