Cómo sobreescribir onSetContentView mientras se utiliza la política de resolución de proporciones en la actividad del juego Base Andengine

Estoy desarrollando (Aprendiendo a construir :)) un juego con andengine GLES2. Estoy utilizando la actividad del juego base , y anula la vista setContent para colocar mi anuncio admob.
Todo funciona bien, excepto la política de resolución.
La política de resolución de relación es la que estoy usando junto con CAMERA_WIDTH = 800; Y CAMERA_HEIGHT = 480;

El problema es siempre que la escena onsetContentView overided no se alinean al centro , los márgenes se muestran sólo en la parte inferior no en la parte superior e inferior, lo mismo hará que al alinear horizontalmente el margen se mostrará sólo en el lado derecho, no en ambos lados. Cómo puedo corregir esto. Estoy dando mi código a continuación

@Override protected void onSetContentView() { System.out.println("Content setting"); this.mRenderSurfaceView = new RenderSurfaceView(this); final LayoutParams layoutParams = new LayoutParams( android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.gravity = Gravity.LEFT ; final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams = new FrameLayout.LayoutParams( layoutParams); adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxxxx"); final FrameLayout.LayoutParams adViewLayoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.LEFT ); final FrameLayout frameLayout = new FrameLayout(this); final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT,Gravity.CENTER); frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams); frameLayout.addView(adView, adViewLayoutParams); this.setContentView(frameLayout, frameLayoutLayoutParams); this.mRenderSurfaceView.setRenderer(this.mEngine, this); } 

Aquí está la imagen lo que consigo puedes ver el margen blanco debajo de la escena si seleccionas la imagen (su no conseguir en la atención debido al desbordamiento de la pila también tenía fondo blanco)

Introduzca aquí la descripción de la imagen

Cualquier sugerencia será muy útil para mí

¿Cómo puedo resolver esta Isuue? Por favor, ayúdame

Gracias a todos,

FIJO:

Después de un juego con los diseños que soy capaz de arreglar esto.

Ahora mi vista de la superficie se alinean al centro y el anuncio se muestra en la forma deseada.

Aquí está mi código

 @Override protected void onSetContentView() { final RelativeLayout relativeLayout = new RelativeLayout(this); final FrameLayout.LayoutParams relativeLayoutLayoutParams = new FrameLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); this.mRenderSurfaceView = new RenderSurfaceView(this); this.mRenderSurfaceView.setRenderer(this.mEngine, this); final android.widget.RelativeLayout.LayoutParams surfaceViewLayoutParams = new RelativeLayout.LayoutParams(BaseGameActivity.createSurfaceViewLayoutParams()); surfaceViewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); relativeLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams); FrameLayout frameLayout = new FrameLayout(this); adView = new AdView(this, AdSize.BANNER, "xxxxxxx"); adView.refreshDrawableState(); frameLayout.addView(adView); relativeLayout.addView(frameLayout); this.setContentView(relativeLayout, relativeLayoutLayoutParams); } 
  • LiveWallpaper error ejemplo Andengine
  • Imagen de fondo de AndEngine
  • Java.lang.IndexOutOfBoundsException: El índice no válido 13, el tamaño es 13
  • BaseGameActivity.runOnUpdateThread () vs. Entity.registerUpdateHandler ()
  • Andengine FPS bajo en ciertos teléfonos
  • Optimización de AndEngine juego
  • Cocos vs AndEngine para android
  • Guardar el estado del juego después de pausa. Y el motor
  • Dibuja una ruta en AndEngine para mover una imagen o un sprite
  • Sprite Rotación alrededor de un punto Andengine / Java
  • Android AndEngine: sprite.detachSelf () no elimina el sprite
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.