I am developing (learning to build :) a game with andengine GLES2
.
I am using Base game activity, and I override the setContent
view to place my admob ad.
Everything works fine except the resolution policy.
Ratio Resolution policy is the one I am using along with CAMERA_WIDTH = 800; and CAMERA_HEIGHT = 480;
The issue is that whenever overridden, the onsetContentView
scene is not getting aligned to the center and margins are displayed only on the bottom and not on both: top and bottom. Same will happen when horizontally aligned: the margin will be displayed only at right side, not on both sides. How can i correct this? I am giving my code below:
@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);
}
here is the image what i get you can see the white margin below the scene if you select the image ( its not get into attention due to stack overflow also had white background )
any suggestions will be very help full to me
How Can i solve this Isuue Please help me
Thanks to all,