2
我想在我的apk的底部放置一個admob廣告,但廣告從不顯示,並且在我的apk中沒有佈局xml,佈局是由gameview類建立,如何在Android的底部放置admob廣告,而不使用佈局xml
logcat的說:onFailedToReceiveAd(廣告請求成功,但沒有廣告返回由於廣告資源不足)
這裏是我的代碼
gameView = new GameView(this, display.getWidth(), display.getHeight());
setContentView(gameView);
RelativeLayout viewLayout = new RelativeLayout(GameActivity.this);
RelativeLayout.LayoutParams flLP2 = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
// Create the adView
AdView adView = new AdView(this, AdSize.BANNER, "xxxxxx");
// Add the adView to it
viewLayout.addView(adView,flLP2);
// Initiate a generic request to load it with an ad
AdRequest adTest = new AdRequest();
adTest.addTestDevice("xxxxxxxxxx");
adView.loadAd(adTest);