AdSize

public final class AdSize extends Object

The size of a banner ad.

Constant Summary

int AUTO_HEIGHT Constant that will cause the height of the ad to scale based on the height of the device in the current orientation.
int FULL_WIDTH Constant that will cause the width of the ad to match the width of the device in the current orientation.

Field Summary

public static final AdSize BANNER Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).
public static final AdSize FLUID A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes.
public static final AdSize FULL_BANNER Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).
public static final AdSize LARGE_BANNER Large banner ad size (320x100 density-independent pixels).
public static final AdSize LEADERBOARD Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).
public static final AdSize MEDIUM_RECTANGLE Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).
public static final AdSize SEARCH A special variant of FLUID to be set on SearchAdView when loading a DynamicHeightSearchAdRequest.
public static final AdSize SMART_BANNER A dynamically sized banner that is full-width and auto-height.
public static final AdSize WIDE_SKYSCRAPER IAB wide skyscraper ad size (160x600 density-independent pixels).

Public Constructor Summary

AdSize(int width, int height)
Create a new AdSize.

Public Method Summary

boolean
equals(Object other)
Compares this AdSize with the specified object and indicates if they are equal.
int
getHeight()
Returns the height of this AdSize in density-independent pixels.
int
getHeightInPixels(Context context)
Returns the height of this AdSize in physical pixels.
int
getWidth()
Returns the width of this AdSize in density-independent pixels.
int
getWidthInPixels(Context context)
Returns the width of this AdSize in physical pixels.
int
boolean
isAutoHeight()
Returns whether this AdSize is auto-height.
boolean
isFluid()
Returns whether this AdSize is of fluid size or not.
boolean
isFullWidth()
Returns whether this AdSize is full-width.
String

Inherited Method Summary

Constants

public static final int AUTO_HEIGHT

Constant that will cause the height of the ad to scale based on the height of the device in the current orientation. An AUTO_HEIGHT ad determines its height during initialization of the AdView and never changes after that.

Constant Value: -2

public static final int FULL_WIDTH

Constant that will cause the width of the ad to match the width of the device in the current orientation. A FULL_WIDTH ad determines its width during initialization of the AdView and never changes after that.

Constant Value: -1

Fields

public static final AdSize BANNER

Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).

public static final AdSize FLUID

A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes.

public static final AdSize FULL_BANNER

Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).

public static final AdSize LARGE_BANNER

Large banner ad size (320x100 density-independent pixels).

public static final AdSize LEADERBOARD

Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).

public static final AdSize MEDIUM_RECTANGLE

Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).

public static final AdSize SEARCH

A special variant of FLUID to be set on SearchAdView when loading a DynamicHeightSearchAdRequest.

public static final AdSize SMART_BANNER

A dynamically sized banner that is full-width and auto-height.

public static final AdSize WIDE_SKYSCRAPER

IAB wide skyscraper ad size (160x600 density-independent pixels). This size is currently not supported by the Google Mobile Ads network; this is intended for mediation ad networks only.

Public Constructors

public AdSize (int width, int height)

Create a new AdSize.

Parameters
width The width of the ad in density-independent pixels.
height The height of the ad in density-independent pixels.
Throws
IllegalArgumentException If the width or height is negative.

Public Methods

public boolean equals (Object other)

Compares this AdSize with the specified object and indicates if they are equal.

public int getHeight ()

Returns the height of this AdSize in density-independent pixels.

public int getHeightInPixels (Context context)

Returns the height of this AdSize in physical pixels. For fluid size, it returns -1.

public int getWidth ()

Returns the width of this AdSize in density-independent pixels.

public int getWidthInPixels (Context context)

Returns the width of this AdSize in physical pixels. For fluid size, it returns -1.

public int hashCode ()

public boolean isAutoHeight ()

Returns whether this AdSize is auto-height.

public boolean isFluid ()

Returns whether this AdSize is of fluid size or not.

public boolean isFullWidth ()

Returns whether this AdSize is full-width.

public String toString ()

Send feedback about...

Need help? Visit our support page.