AdSize

class AdSize 

The size of a banner ad.

Summary

Constants

const Int

Constant that will cause the height of the ad to scale based on the height of the device in the current orientation.

const AdSize !

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

const AdSize !

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

const AdSize !

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

const Int
FULL_WIDTH = -1

Constant that will cause the width of the ad to match the width of the device in the current orientation.

const AdSize !

An invalid AdSize that will cause the ad request to fail immediately.

const AdSize !

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

const AdSize !

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

const AdSize !

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

const AdSize !

This property is deprecated.

Use getCurrentOrientationAnchoredAdaptiveBannerAdSize instead.

const AdSize !

IAB wide skyscraper ad size (160x600 density-independent pixels).

Public constructors

AdSize (width:  Int , height:  Int )

Creates a new AdSize .

Public functions

Boolean
equals (other:  Any ?)

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

java-static AdSize !
getCurrentOrientationAnchoredAdaptiveBannerAdSize (
    context:  Context !,
    width:  Int
)

Returns an AdSize with the given width and a Google-optimized height to create a banner ad.

java-static AdSize !
getCurrentOrientationInlineAdaptiveBannerAdSize (
    context:  Context !,
    width:  Int
)

Returns an AdSize with the given width and a height that is always 0.

Int
getHeightInPixels (context:  Context !)

Returns the height of this AdSize in physical pixels.

java-static AdSize !
getInlineAdaptiveBannerAdSize (width:  Int , maxHeight:  Int )

Returns an AdSize with the given width and a height that is always 0.

java-static AdSize !

Returns an AdSize with the given width and a Google-optimized height to create a banner ad.

java-static AdSize !

Returns an AdSize with the given width and a height that is always 0.

java-static AdSize !

Returns an AdSize with the given width and a Google-optimized height to create a banner ad.

java-static AdSize !

Returns an AdSize with the given width and a height that is always 0.

Int
getWidthInPixels (context:  Context !)

Returns the width of this AdSize in physical pixels.

Int
Boolean

Returns whether this AdSize is auto-height.

Boolean
isFluid ()

Returns whether this AdSize is of fluid size or not.

Boolean

Returns whether this AdSize is full-width.

String !

Public properties

Int
Int

Constants

AUTO_HEIGHT

const val  AUTO_HEIGHT 
= -2:  Int 

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.

BANNER

const val  BANNER 
 AdSize 
!

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

FLUID

const val  FLUID 
 AdSize 
!

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

FULL_BANNER

const val  FULL_BANNER 
 AdSize 
!

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

FULL_WIDTH

const val  FULL_WIDTH 
= -1:  Int 

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 and never changes after that.

INVALID

const val  INVALID 
 AdSize 
!

An invalid AdSize that will cause the ad request to fail immediately.

LARGE_BANNER

const val  LARGE_BANNER 
 AdSize 
!

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

LEADERBOARD

const val  LEADERBOARD 
 AdSize 
!

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

MEDIUM_RECTANGLE

const val  MEDIUM_RECTANGLE 
 AdSize 
!

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

SMART_BANNER

const val  SMART_BANNER 
 AdSize 
!

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

WIDE_SKYSCRAPER

const val  WIDE_SKYSCRAPER 
 AdSize 
!

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

AdSize

 AdSize 
(width:  Int 
, height:  Int 
)

Creates a new AdSize .

Parameters
width:  Int

The width of the ad in density-independent pixels.

height:  Int

The height of the ad in density-independent pixels.

Throws
java.lang.IllegalArgumentException

If the width or height is negative.

Public functions

equals

fun  equals 
(other:  Any 
?):  Boolean 

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

getCurrentOrientationAnchoredAdaptiveBannerAdSize

java-static fun  getCurrentOrientationAnchoredAdaptiveBannerAdSize 
(
    context:  Context !,
    width:  Int
):  AdSize !

Returns an AdSize with the given width and a Google-optimized height to create a banner ad. The size returned will have an aspect ratio similar to AdSize , suitable for anchoring near the top or bottom of your app. The height will never be larger than 15% of the device's current orientation height and never smaller than 50px. This function always returns the same height for any width / device combination. If the context is null or the device height cannot be determined from the context, INVALID is returned.

Returns
AdSize !

An AdSize object. Returns INVALID if the context is null or the device height cannot be determined from the context.

getCurrentOrientationInlineAdaptiveBannerAdSize

java-static fun  getCurrentOrientationInlineAdaptiveBannerAdSize 
(
    context:  Context !,
    width:  Int
):  AdSize !

Returns an AdSize with the given width and a height that is always 0. This ad size allows Google servers to choose an optimal ad size with a height less than or equal to the height of the screen in the requested orientation. The exact size of the ad returned can be retrieved by calling getAdSize inside the onAdLoaded callback. This ad size is most suitable for ads intended to be displayed inside scrollable content.

getHeightInPixels

fun  getHeightInPixels 
(context:  Context 
!):  Int 

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

getInlineAdaptiveBannerAdSize

java-static fun  getInlineAdaptiveBannerAdSize 
(width:  Int 
, maxHeight:  Int 
):  AdSize 
!

Returns an AdSize with the given width and a height that is always 0. This ad size allows Google servers to choose an optimal ad size with a height less than or equal to the max height given in the maxHeight parameter. The exact size of the ad returned can be retrieved by calling getAdSize inside the onAdLoaded callback. This ad size is most suitable for ads intended to be displayed inside scrollable content.

Parameters
maxHeight:  Int

The maximum height that a loaded ad will have. Must be at least 32 dp, but a maxHeight of 50 dp or higher is recommended.

getLandscapeAnchoredAdaptiveBannerAdSize

java-static fun  getLandscapeAnchoredAdaptiveBannerAdSize 
(context:  Context 
!, width:  Int 
):  AdSize 
!

Returns an AdSize with the given width and a Google-optimized height to create a banner ad. The size returned will have an aspect ratio similar to BANNER , suitable for anchoring near the top or bottom of your app. The height will never be larger than 15% of the device's height in landscape mode and never smaller than 50px. This function always returns the same height for any width / device combination. If the context is null or the device height cannot be determined from the context, INVALID is returned.

Returns
AdSize !

An AdSize object. Returns INVALID if the context is null or the device height cannot be determined from the context.

getLandscapeInlineAdaptiveBannerAdSize

java-static fun  getLandscapeInlineAdaptiveBannerAdSize 
(context:  Context 
!, width:  Int 
):  AdSize 
!

Returns an AdSize with the given width and a height that is always 0. This ad size allows Google servers to choose an optimal ad size with a height less than or equal to the height of the screen in landscape orientation. The exact size of the ad returned can be retrieved by calling getAdSize inside the onAdLoaded callback. This ad size is most suitable for ads intended to be displayed inside scrollable content.

getPortraitAnchoredAdaptiveBannerAdSize

java-static fun  getPortraitAnchoredAdaptiveBannerAdSize 
(context:  Context 
!, width:  Int 
):  AdSize 
!

Returns an AdSize with the given width and a Google-optimized height to create a banner ad. The size returned will have an aspect ratio similar to BANNER , suitable for anchoring near the top or bottom of your app. The height will never be larger than 15% of the device's portrait height and never smaller than 50px. This function always returns the same height for any width / device combination.

Returns
AdSize !

An AdSize object. Returns INVALID if the context is null or the device height cannot be determined from the context.

getPortraitInlineAdaptiveBannerAdSize

java-static fun  getPortraitInlineAdaptiveBannerAdSize 
(context:  Context 
!, width:  Int 
):  AdSize 
!

Returns an AdSize with the given width and a height that is always 0. This ad size allows Google servers to choose an optimal ad size less than or equal to the height of the screen in portrait orientation. The exact size of the ad returned can be retrieved by calling getAdSize inside the onAdLoaded callback. This ad size is most suitable for ads intended to be displayed inside scrollable content.

getWidthInPixels

fun  getWidthInPixels 
(context:  Context 
!):  Int 

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

hashCode

fun  hashCode 
():  Int 

isAutoHeight

fun  isAutoHeight 
():  Boolean 

Returns whether this AdSize is auto-height.

isFluid

fun  isFluid 
():  Boolean 

Returns whether this AdSize is of fluid size or not.

isFullWidth

fun  isFullWidth 
():  Boolean 

Returns whether this AdSize is full-width.

toString

fun  toString 
():  String 
!

Public properties

height

val  height 
 Int 

width

val  width 
 Int 
Create a Mobile Website
View Site in Mobile | Classic
Share by: