Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm using AdMob but it should be similar.</p> <p>Like @Sergey Benner referenced, you have to override <code>onSetContentView</code> in your activity, then create the <code>RenderSurfaceView</code> and your ad view manually.</p> <p>First of all, create a <code>FrameLayout</code> to contain AndEngine's view and the ad view. Add AndEngine's view and create your ad view, then set the frame layout as the content view.</p> <pre><code>@Override protected void onSetContentView() { //Creating the parent frame layout: final FrameLayout frameLayout = new FrameLayout(this); //Creating its layout params, making it fill the screen. final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT); //Creating the banner view. BannerView bannerView = new BannerView(this); //.... //Do any initiallizations on the banner view here. //.... //Creating the banner layout params. With this params, the ad will be placed in the top of the screen, middle horizontally. final FrameLayout.LayoutParams bannerViewLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL); //Creating AndEngine's view. this.mRenderSurfaceView = new RenderSurfaceView(this); mRenderSurfaceView.setRenderer(mEngine, this); //createSurfaceViewLayoutParams is an AndEngine method for creating the params for its view. final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams = new FrameLayout.LayoutParams(super.createSurfaceViewLayoutParams()); //Adding the views to the frame layout. frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams); frameLayout.addView(bannerView, bannerViewLayoutParams); //Setting content view this.setContentView(frameLayout, frameLayoutLayoutParams); } </code></pre> <p>Place this method in your <code>BaseGameActivity</code> class.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload