我对 admob 有一个奇怪的问题,有时只显示一小部分广告。有时它完全没问题,但其他时候只显示顶部(比如前 5%),因此那里有一个添加。我将它们放入 OpenGL 1x 中,如下所示:
GLSurfaceView mGLSurfaceView;
LinearLayout ll;
FrameLayout fl;
AdView adView;
mGLSurfaceView = new GLSurfaceView(this);
mGLSurfaceView.setRenderer(this);
adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxx");
adView.loadAd(new AdRequest());
ll=new LinearLayout(this);
ll.addView(adView); // put in LinearLayout, as the ad can't be moved in layout but the layout can be moved when child of another layout
fl = new FrameLayout(this);
fl.addView(mGLSurfaceView);
fl.addView(ll); // LinearLayout with ad put in FrameLayout. FrameLayout allows us to put other layouts within it where you want.
ll.setPadding(0, 5 /* amount of pixels from top*/ , 0, 0);
ll.setHorizontalGravity(0x11 /*center*/);
setContentView(fl);