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 tothis , 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?
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" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.