Cocos2d-x 2.x android下集成admob广告(二)底部banner

前端之家收集整理的这篇文章主要介绍了Cocos2d-x 2.x android下集成admob广告(二)底部banner前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

修改%project_name%.java
1、屏蔽
/* LinearLayout.LayoutParams adParams = new LinearLayout.LayoutParams(
width,
LinearLayout.LayoutParams.WRAP_CONTENT);
*/
屏蔽
// addContentView(adView,adParams);
2、添加在。。。之后
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);

RelativeLayout relativeLayout=new RelativeLayout(this);

            Cocos2dxActivity.mFrameLayout.addView(relativeLayout);

            RelativeLayout.LayoutParams adViewParams = new RelativeLayout.LayoutParams(
                    width,AdView.LayoutParams.WRAP_CONTENT);
                //important
                adViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);


            relativeLayout.addView(adView,adViewParams);
原文链接:https://www.f2er.com/cocos2dx/341090.html

猜你在找的Cocos2d-x相关文章