由于cocos2d android没有布局xml文件,你可以通过编程方式添加它. onstart方法本身的crate线性布局.
原文链接:https://www.f2er.com/cocos2dx/338150.html喜欢这个
LinearLayout.LayoutParams adParams = new LinearLayout.LayoutParams( getWindowManager().getDefaultDisplay().getWidth(),getWindowManager().getDefaultDisplay().getHeight()+getWindowManager().getDefaultDisplay().getHeight()-50); adView = new AdView(SimpleGame.this,AdSize.BANNER,"your Ad ID"); adView.setAdListener(SimpleGame.this); AdRequest request = new AdRequest(); request.addTestDevice(AdRequest.TEST_EMULATOR); adView.loadAd(request); CCDirector.sharedDirector().getActivity().addContentView(adView,adParams);
这应该是尝试和捕捉.