为了快速的在cocos2d-x中添加广告条,使用了以下代码
try{ LinearLayout.LayoutParams adParams = new LinearLayout.LayoutParams( getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight()+getWindowManager().getDefaultDisplay().getHeight()-50); adView = new AdView(this, AdSize.BANNER, "**********"); AdRequest request = new AdRequest(); adView.loadAd(request); // Adding full screen container addContentView(adView, adParams); }catch (Exception e) { } |
这样,banner就可以在底部显示,非常简单和快速
- 本文固定链接: https://freemanapp.com/zh/?p=53
- 转载请注明: freeman 于 FreemanApp 发表