title: Set gravity for LinearLayout programmatically
body: <p>I have followed an instruction for making new AdMob plugin for Unity. Ads show up correctly, but I have problem with bottom position. They show up at top of the screen. I have set gravity to bottom (for FrameLayout) but banner ads again show up at the top of screen. </p>
  
  <p>I dont have any .xml file with LinearLayout/FrameLayout tags. </p>
  
  <p>Here is all code:</p>
  
  <pre><code>public class playads {
  private String adUnitID = "ca-app-pub-9578188175087140/5483276313";
  private Activity activity; //Store the android main activity
  private AdView adView; //The AdView we will display to the user
  private LinearLayout layout; //The layout the AdView will sit on
  
  public playads () {
      activity = UnityPlayer.currentActivity;
      activity.runOnUiThread(new Runnable() {
          public void run(){
              adView = new AdView(activity);
              adView.setAdUnitId(adUnitID);
              adView.setAdSize(AdSize.BANNER);
  
              AdRequest request = new AdRequest.Builder().build();
  
              adView.setAdListener(new AdListener() {
                  public void onAdLoaded() {
                      if(layout == null)
                          Log.d("null", "null");
                          {
                              activity.runOnUiThread(new Runnable() {
                                  public void run(){
                                      layout = new LinearLayout(activity);
                                      layout.addView(adView);
                                      //FrameLayout.LayoutParams p = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                                      //p.gravity=Gravity.BOTTOM;
                                      activity.addContentView(layout, new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
                                      ((FrameLayout.LayoutParams)layout.getLayoutParams()).gravity = Gravity.BOTTOM;
                                  }
                              });
                          }
                      }
                  }
              );
              adView.loadAd(request);
          }
  
      });   
  }
  }
  </code></pre>
  
  <p>I really dont know what the problem is. I spent all day to fint it, but without any solution :(</p>