【发布时间】:2014-02-11 19:01:09
【问题描述】:
我正在尝试在我用 AndEngine 制作的游戏中展示 adMob 广告。
我能够在 LogCat 中针对我的 WebRequest 获取 WebViewResponse,此外,当我删除网络权限时,我会收到一个带有网络要求错误的黑匣子。但是当我添加网络要求时,会收到网络响应,但没有成功显示它。
我正在做的可能是什么问题?
谢谢。
@Override
protected void onSetContentView() {
final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.FILL_PARENT);
adView = new AdView(this, AdSize.BANNER, “xxxxxxxxx”);
adView.refreshDrawableState();
adView.setVisibility(AdView.VISIBLE);
final FrameLayout.LayoutParams adViewLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL);
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50,
getResources ().getDisplayMetrics ());
// top of AD is at middle of the screen
adViewLayoutParams.topMargin = height/2;
Log.v("AD", "Adview height : " + height);
Log.v("AD", "Adview size {x:" + adView.getWidth() + ", y: " + adView.getHeight()+ "}");
adView.setAlpha(255);
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice( AdRequest.TEST_EMULATOR);
adRequest.addTestDevice(“xxxxxxxxxxxxxx”);
adView.loadAd(adRequest);
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);
}
【问题讨论】:
-
logcat 说什么?