[Native Ads] MediaView can not set width match parent?

1,196 views
Skip to first unread message

ngodinh...@gmail.com

unread,
Sep 4, 2018, 4:08:11 AM9/4/18
to Google Mobile Ads SDK Developers
When I use MediaView instead of ImageView to show main image asset. I set MediaView width = match_parent, height = wrap_content. But when ads display MediaView not wrap Image. How I can use adjustViewBound= true in MediaView like ImageView?
device-2018-09-04-150552.png

mobileadssdk-a...@google.com

unread,
Sep 4, 2018, 8:03:18 AM9/4/18
to google-adm...@googlegroups.com, ngodinh...@gmail.com
Hi,

Thank you for reaching out to us regarding this.

I made modifications with our sample app to test your scenario and set a light green background to the MediaView to see the behavior visually and below are my findings.
  • When I set the MediaView's width to match_parent and its height to wrap_content, the Ad itself occupied the full width space of the MediaView, however, I can see that there is a proportional amount of blank space above and below the Ad as you can see in the attached screenshot (mediaview.png). Nevertheless, the set width for the MediaView itself is still followed.
  • I also tested playing around different values for the height (150 dp with width set to match_parent) of the MediaView and I can see that the Ad itself adjusted accordingly to leave a proportional space outside the ad but still within the MediaView. The set width for the MediaView itself is still followed.
Given these information, the width set for the MediaView is followed, however, the Ad itself (which is provided from the server) seems to follow an aspect ratio (to maintain the visual quality of the image) that results to the proportional spaces outside the ad. The spaces gives the impression that the MediaView is not following the width set but in fact the space are part of the MediaView's content. 

For testing purposes, could you try setting a light background to your MediaView and see if it does follow the width set on your end? Feel free to test it with our sample app as well.

Regards,
Ivan Bautista
Mobile Ads SDK Team



On 09/04/18 16:08:11 ngodinh...@gmail.com wrote:
When I use MediaView instead of ImageView to show main image asset. I set MediaView width = match_parent, height = wrap_content. But when ads display MediaView not wrap Image. How I can use adjustViewBound= true in MediaView like ImageView?

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/1b0fb5f5-3c1e-46cb-9d9c-930b827b8004%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
height150.png
mediaview.png

Ab Lem

unread,
Sep 5, 2018, 7:55:11 AM9/5/18
to Google Mobile Ads SDK Developers
We just need the "scaleType" to be added to MediaView.

mobileadssdk-a...@google.com

unread,
Sep 5, 2018, 11:47:14 PM9/5/18
to Ab Lem, Google Mobile Ads SDK Developers
Hi,

Thank you for reaching out to us.

We will raise your suggestion to the rest of the team, however, we can't assure to you that it will be included in any future releases. Nevertheless, for any general updates to the Mobile Ads SDK, you can just keep an eye on our Release Notes.

Regards,
Ivan Bautista
Mobile Ads SDK Team


--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

DarShan Pandya

unread,
Sep 6, 2018, 9:55:57 AM9/6/18
to Google Mobile Ads SDK Developers
+1

mobileadssdk-a...@google.com

unread,
Sep 7, 2018, 3:37:59 AM9/7/18
to DarShan Pandya, Google Mobile Ads SDK Developers
Hi everyone,

I just want to clarify in my first response that instead of the Native Ad itself, I'm referring to the Main image (loaded inside the MediaView) which is the one that has proportional spaces outside of it.

Regards,
Ivan Bautista
Mobile Ads SDK Team



On 09/06/18 21:55:57 itzno...@gmail.com wrote:
+1

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

DarShan Pandya

unread,
Sep 7, 2018, 3:44:36 AM9/7/18
to Google Mobile Ads SDK Developers
Yes, I know...
But if the scaleType is added, atleast the Image can be set to fitXY which won't show extra white space...

Fran Soto

unread,
Sep 7, 2018, 10:45:34 AM9/7/18
to Google Mobile Ads SDK Developers
ScaleType or the possibility to set the inner imageView adjustToBound property to true should be added to the MediaView.

mobileadssdk-a...@google.com

unread,
Sep 9, 2018, 11:07:50 PM9/9/18
to Fran Soto, Google Mobile Ads SDK Developers
Hi everyone, 

We have raised your concerns to the rest of the team and we're currently looking into it. I will get back to this thread for any official feedback.

Regards,
Ivan Bautista
Mobile Ads SDK Team
On 09/07/18 22:45:34 basurill...@gmail.com wrote:
ScaleType or the possibility to set the inner imageView adjustToBound property to true should be added to the MediaView.

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

mobileadssdk...@google.com

unread,
Mar 1, 2019, 1:27:03 PM3/1/19
to Fran Soto, Google Mobile Ads SDK Developers
Hi everyone,

The team is actively working on scaling options for the image rendered in the MediaView. However, we don't have any definite timelines for this. I suggest that you keep an eye on our Release Notes for future updates.

Regards,
Ivan Bautista
Mobile Ads SDK Team



On 09/07/18 22:45:34 basurill...@gmail.com wrote:
ScaleType or the possibility to set the inner imageView adjustToBound property to true should be added to the MediaView.

H K Chakladar

unread,
Sep 6, 2019, 9:05:11 AM9/6/19
to Google Mobile Ads SDK Developers
You can use this hack until they release another method, from this SO

mediaView.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
   
@Override
   
public void onChildViewAdded(View parent, View child) {
       
if (child instanceof ImageView) {
           
ImageView imageView = (ImageView) child;
            imageView
.setAdjustViewBounds(true);
       
}
   
}

   
@Override
   
public void onChildViewRemoved(View parent, View child) {}
});
Reply all
Reply to author
Forward
0 new messages