java - Cocos2d: What a the black stripe below CCGLSurfaceView? -
i'm trying add admob banner under game scene black stripe overlaps half banner. removed banner see if problem of admob stripe still there.
how can remove it? or there way display banner on black stripe?
source:
public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); adview = new adview(this); adview.setadsize(adsize.banner); adview.setadunitid("xxxxxxxxx"); adrequest adrequest = new adrequest.builder().addtestdevice( adrequest.device_id_emulator).build(); adview.loadad(adrequest); adview.setbackgroundcolor(color.black); setrequestedorientation(activityinfo.screen_orientation_portrait); requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); mglsurfaceview = new ccglsurfaceview(this); background = new linearlayout(this); game_layout = new linearlayout(this); ad_layout = new linearlayout(this); background.setorientation(linearlayout.vertical); ad_layout.setorientation(linearlayout.vertical); game_layout.setorientation(linearlayout.vertical); ad_layout.addview(adview); game_layout.addview(mglsurfaceview); linearlayout.layoutparams game_params = new linearlayout.layoutparams( linearlayout.layoutparams.match_parent, linearlayout.layoutparams.wrap_content, 1f); background.addview(game_layout, game_params); linearlayout.layoutparams ad_params = new linearlayout.layoutparams( linearlayout.layoutparams.match_parent, linearlayout.layoutparams.wrap_content); background.addview(ad_layout, ad_params); this.setcontentview(background); } public void onstart() { super.onstart(); ccdirector.shareddirector().attachinview(mglsurfaceview); ccdirector.shareddirector().setdisplayfps(true); ccdirector.shareddirector().setanimationinterval(1.0f / 60.0f); ccscene scene = gamestartlayer.scene(); ccdirector.shareddirector().runwithscene(scene); }
i've found out reason why banner overplayed game scene. mistake silly.
following methods must updated:
@override public void onpause() { **if (adview != null) adview.pause();** super.onpause(); ccdirector.shareddirector().pause(); } @override public void onresume() { super.onresume(); ccdirector.shareddirector().resume(); **if (adview != null) adview.resume();** }
Comments
Post a Comment