【发布时间】:2015-05-09 16:20:03
【问题描述】:
我有一个在surfaceView 上绘制的android 游戏,并且我在上面使用FrameLayout 有admob 广告。 FrameLayout 布局 = new FrameLayout(this); this.addContentView(lay, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
AdView adView = new AdView(this, AdSize.BANNER, "xxxxxxxx");
lay.addView(renderer, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
lay.addView(adView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
adView.setGravity(Gravity.LEFT);
this.setContentView(lay);
adView.loadAd(new AdRequest());
一切都很好。我想集成新的 google play services admob 我已经把上面的代码改成了
FrameLayout lay = new FrameLayout(this);
this.addContentView(lay, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
adView = new AdView(this);
adView.setAdUnitId("xxxxxxx");
adView.setAdSize(AdSize.BANNER);
lay.addView(adView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
this.setContentView(lay);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
admob 视图未显示。我知道这是没有出现的视图,因为如果我只将 AdView 添加到 frameLayour 中,那么我可以毫无问题地看到广告
有人遇到过这个问题吗?有人对此有什么建议吗?
国王的问候
【问题讨论】:
标签: android android-layout admob google-play-services surfaceview