我有以下代码可以在我的游戏顶部显示来自 Admob 的广告。
问题出在这里。我的游戏处于横向模式,但我希望广告以 Potrait 模式出现在顶部。
现状http://postimg.org/image/z4dc271x9/
需要最终输出http://postimg.org/image/83d7afe9h/
我应该在我的代码中更改什么?
this.mRenderSurfaceView = new RenderSurfaceView(this);
this.mRenderSurfaceView.setRenderer(this.mEngine,this);
final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams = new FrameLayout.LayoutParams(super.createSurfaceViewLayoutParams());
//Creating the banner view.
AdView adView = new AdView(this, AdSize.BANNER, "MY_ID_HERE");
adView.loadAd(new AdRequest());
final FrameLayout.LayoutParams adViewLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER | Gravity.CENTER_HORIZONTAL);
final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT);
frameLayout.addView(this.mRenderSurfaceView,surfaceViewLayoutParams);
frameLayout.addView(adView,adViewLayoutParams);
this.setContentView(frameLayout, frameLayoutLayoutParams);
谢谢!