title: AdMob Banners and GLSurfaceview (programmatically)
body: <p>Finally, I have a banner ad at the top of my <strong>GLSurfaceview</strong>. However, it appears with a black background that takes up the whole width of the screen and covers the top of my game area like so (I should also point out that the play area is also moved downwards a little so the bottom is also missing).</p>
  
  <p><img src="https://i.stack.imgur.com/aXJv5.jpg" alt="enter image description here"></p>
  
  <p>What I need to do is move the banner to the bottom of the screen and, keep it central and remove this black background so it looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/APpCi.jpg" alt="enter image description here"></p>
  
  <p>I tried to use XML but was getting a lot of errors so I switched to doing this completely in Java (and managed to get this far) - however quality information on how to do this  with GLSurfaceView is lacking IMHO so I'm hoping someone can tell me where I'm going wrong.</p>
  
  <p><strong>Code</strong></p>
  
  <p>Here is my onCreate() method:</p>
  
  <pre><code>    @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          // Create an ad.
          adView = new AdView(this);
          adView.setAdSize(AdSize.BANNER);
          adView.setAdUnitId(AD_UNIT_ID);
  
          // Add the AdView to the view hierarchy. The view will have no size
          // until the ad is loaded.
          LinearLayout layout = new LinearLayout(this);
          layout.setOrientation(LinearLayout.VERTICAL);
  
          // Create an ad request.
          // get test ads on a physical device.
          AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(TestDeviceID)
            .build();
  
          // Start loading the ad in the background.
          adView.loadAd(adRequest);
  
          //Request full screen
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
          WindowManager.LayoutParams.FLAG_FULLSCREEN);
  
          //Create a displayMetrics object to get pixel width and height
          metrics = new DisplayMetrics();
          getWindowManager().getDefaultDisplay().getMetrics(metrics);
          width = metrics.widthPixels;
          height = metrics.heightPixels;
  
          //Create and set GL view (OpenGL View)
          myView = new MyGLSurfaceView(MainActivity.this);
          layout.addView(adView);
          layout.addView(myView);
  
  
          //Create a copy of the Bundle
          if (savedInstanceState != null){
              newBundle = new Bundle(savedInstanceState);         
          }
  
          //Set main renderer             
          setContentView(layout);
  
  }
  </code></pre>
  
  <p>When the banner changes, it also appears to 'flicker', but I can deal with that in a separate question.</p>