0

ゲームの上に Admob の広告を表示する次のコードがあります。

問題はここにあります。私のゲームはランドスケープ モードですが、広告をポートレイト モードで一番上に表示したいと考えています。

現状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);

ありがとう!

4

1 に答える 1