我在我的libgdx游戏上有横幅广告,每次点击广告然后返回游戏时游戏重新启动而不是暂停,然后恢复就像当我点击" home buttom& #34;
以下是我如何将adView添加到libgdx游戏
// adding adds
layout = new RelativeLayout(this);
View gameView = initializeForView(game, configuration);
adView = new AdView(this);
// this is a test ad
adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");
adView.setAdSize(AdSize.BANNER);
adView.loadAd(new AdRequest.Builder()
.build());
// Add the AdMob view
adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layout.addView(gameView);
layout.addView(adView, adParams);
// Hook it all up
setContentView(layout);