title: Google Ads MediaView not correctly resizing height to wrap_content when displaying image
body: <p>I got an email from AdMob today saying:</p>
  
  <blockquote>
    <p>Change to native ads policy: Native ads will require MediaView to
    render the video or main image asset. In an effort to help you deliver
    a better ad experience more easily, beginning October 29th, native ads
    will require MediaView to render the video or main image asset. Ad
    units not compliant by this date will stop serving ads, which could
    impact your ad revenue.</p>
  </blockquote>
  
  <p>I tried this out in my Android app, removing the separate handling of images with <code>ImageView</code> and video with <code>MediaView</code>, but I have found that the MediaView is not resizing the view's height according to the height of the image it displays. </p>
  
  <p>In <a href="https://codelabs.developers.google.com/codelabs/admob-native-advanced-feed-android/index.html#5" rel="noreferrer">this</a> codelab example from Google, a fixed height and width for the <code>MediaView</code> are used. I cannot do this, as this screen is responsive to the screen size, which will change depending on the device. The fact that the image can be dynamically resized is one of the main benefits for using <code>UnifiedNativeAds</code> instead of predefined ads such as banners. </p>
  
  <p>This is how I need to be displaying the <code>MediaView</code>, using <code>match_parent</code> for width and <code>wrap_content</code> for height. </p>
  
  <pre><code>&lt;com.google.android.gms.ads.formats.MediaView
              android:id="@+id/ad_media"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="center_horizontal"
              android:adjustViewBounds="true"
              android:scaleType="fitXY"/&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/prQnd.png" rel="noreferrer">This is what I am currently getting from the above code</a></p>
  
  <p><a href="https://i.stack.imgur.com/LTXmV.png" rel="noreferrer">This is what I need and expect it to look like from using <code>wrap_content</code></a></p>
  
  <p>In the previous case where we were able to render the images separately using ImageView, the <code>wrap_content</code> value correctly sized the image.</p>
  
  <p>Does anyone have a workaround for this? How can I follow the new Google requirements without hardcoding the <code>MediaView</code>'s height?</p>
  
  <p>My full code can be found <a href="https://github.com/sarah-brittan/google-ads-android-demo" rel="noreferrer">here</a>, in my demo app on github. </p>