question

Dje avatar image
Dje asked

Layout size problem when refreshing an auto ad size (loadAd)

Hello, My layout looks like this : The problem is that each time I call a loadAd to refresh the ad, the AdLayout height size becomes 0 (just the time to load the ad) and that is not really nice for the application (rescale all the UI). Is there a solution to fix this ? Best regards, Dje073.
mobile ads
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dje avatar image
Dje answered
Ok, if it can help someone, I found a workarround : I changed in and eachtime, before calling loadAd, I do : if (amazonAdView.getHeight() > 0) amazonAdView.setMinimumHeight(amazonAdView.getHeight());
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
Hi, If your AdLayout is too small then no ad will be returned and ad loading will fail. You can ensure that your AdLayout is large enough for most scenarios by creating a screen-wide AdLayout with its width set to MATCH_PARENT and its height to WRAP_CONTENT. Check the below link for ad layout and recommended size info: https://developer.amazon.com/sdk/mobileads/understanding-api.html#Amazon%20Mobile%20Ad%20Network%20Concepts
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dje avatar image
Dje answered
Yes, but that is the problem. When using these settings, each time I want to refresh the ad (with loadAd) the AdLayout height size isn't maintained during the loading (= 0) All the screen is refreshed with the ad height = 0 and then re-refreshed when the ad is displayed (~some kind of blink) So my workarround works well, except when there is not enought space to display an Ad.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dje avatar image
Dje answered
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.