問題廣告:廣告不顯示在第一個請求,但是當它使第二請求時,它顯示的權利。在發出第二個請求前大約2秒鐘,第一個請求的廣告就會出現。有任何想法嗎? 謝謝,AdMob的Google+ Andengine只顯示在第二個請求
編輯:我改變了重力TOP,現在它顯示了第一次,但只是和廣告的上半部分,離奇的,任何想法?
@Override
protected void onSetContentView() {
if(adView != null){
return;
}
final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
final FrameLayout.LayoutParams adViewLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM);
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(getResources().getString(R.string.ad_unit_id));
adView.setAdListener(new ToastAdListener(this));
adView.loadAd(new AdRequest.Builder().build());
this.mRenderSurfaceView = new RenderSurfaceView(this);
mRenderSurfaceView.setRenderer(mEngine,this);
final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams =
new FrameLayout.LayoutParams(super.createSurfaceViewLayoutParams());
frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams);
frameLayout.addView(adView, adViewLayoutParams);
this.setContentView(frameLayout, frameLayoutLayoutParams);
}
@Override
protected void onPause() {
if(adView!=null){
adView.pause();
}
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
if(adView!=null){
adView.resume();
}
}
@Override
protected void onDestroy() {
if(adView!=null){
adView.destroy();
}
super.onDestroy();
}
也,當我點擊任何按鈕或後退按鈕,活動退出前,廣告正確顯示 – alexandrenofre