I am on a new App and in that I want to show some ads on the bottom. The AdView however is height 0dp at app startup and inflates only when the ads are loaded and then resizes the fragment and moves its content and children, which I want to avoid obviously.

My app is build like following:

In my MainActivity view I have a ConstraintLayout which has the Toolbar, the fragment container and the AdView as children and it's arranged like in the screenshot above. So the container is between the AdView and Toolbar which is causing the problem.

Of course I can make the fragment container align to the bottom of its parent but then the ads are shown above the containers content which can cause problems on smaller screens.

Is there any way I can somehow "reserve" the AdViews size upon app startup or something like this?

Tag:google-ads-api, android, android-studio

Add a new comment.