0

Im trying to display an admob ad which completely covers the width of screen (like SMART_BANNER), and 90dp constant height.

using this code, i can set the height to 90dp, but how can i make the ad width fill the width?

AdSize adSize = new AdSize(deviceSpecificWidth, 90);

According to this, these are the standard sizes of SMART_BANNER

Screen width x 32|50|90

can i force the smart banner to only use 90dp height in every device?

shaheer shukur
  • 1,077
  • 2
  • 12
  • 19

1 Answers1

0

I would suggest to use the newly introduced AdMob Adaptive Banners. They don't require adjustments on your side and they utilize all the width available and keeping the aspect ratio (which was a problem before).

Embed them into a FrameLayout like following

<FrameLayout
    android:id="@+id/adFragment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center|bottom" />
S. Gissel
  • 1,788
  • 2
  • 15
  • 32