title: How to use SMARTBANNER (AdMob) and be sure to show it
body: <p>I decided to put a SMARTBANNER with AdMob on my app.
  As it is stated from the documentation:
  <a href="https://developers.google.com/mobile-ads-sdk/docs/admob/smart-banners" rel="nofollow">smart-banners sizes</a>
  on Android, portrait, I reserved 50 dp of height. So I just reserved an empty linear layout for it, it worked for me in past apps:</p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/layoutAd"
      android:layout_width="fill_parent"
      android:layout_height="50dp"
      android:orientation="vertical" /&gt;
  </code></pre>
  
  <p>And then used the method:</p>
  
  <pre><code>   private void createAdView() {
          if (C.AD_ON) {
              ad_view = new AdView(this, AdSize.SMART_BANNER, C.AD_APPLICATION_ID);
              LinearLayout l = (LinearLayout) findViewById (R.id.layoutAd);
              l.addView (ad_view);
              AdRequest a = new AdRequest();
              ad_view.loadAd(a);
          }
      }
  </code></pre>
  
  <p>Now, while generally this simple method works, in this case I get an error:</p>
  
  <pre><code>Not enough space to show ad! Wants: &lt;480, 90&gt;, Has: &lt;480, 50&gt;
  </code></pre>
  
  <p>??? 480x90? 480x50? I cannot find any of these sizes in the previous table... Where do they come from?
  Anyway, the ad does not show.</p>
  
  <p>I then tried to reserve 90dp instead of 50dp, and the ad shows correctly, leaving an emtpy space of... guess what... about 40dp.</p>
  
  <p>At this point a question arose to me: before, with my previous apps, everything worked on phones. I thought that everything was adapting to different screen sizes and densities. Now I am scared that actually many of my ads couldn't show because the ad was expecting 90dp instead of 50dp, or whatever other number.</p>
  
  <p>Actually the ONLY reason for which I decided to put a SMARTBANNER was that I thought to be free from this kind of problems!</p>
  
  <p>Now... What should I do to make this work correctly on EVERY possible screen and be reasonably sure that it won't fail on some density or some size? Should I detect by myself what device am I running on, and then reserve 50, 90 or maybe 55 dp programmatically? This sounds absurd to me!</p>
  
  <p>Isn't there such a function as some "WRAP_CONTENT" that is appliable to the banner, so that I don't have to manually specify 90 or 50 pixels, but just expect the correct banner to show and the layout to adapt to it?</p>
  
  <p>Thank you.</p>