# AdSize

# AdSize


```
class AdSize
```

<br />

*** ** * ** ***

The size of a banner ad.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#AUTO_HEIGHT() = -2` Constant that will cause the height of the ad to scale based on the height of the device in the current orientation. |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#BANNER()` Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels). |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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. |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#FULL_BANNER()` Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels). |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#FULL_WIDTH() = -1` Constant that will cause the width of the ad to match the width of the device in the current orientation. |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` An invalid AdSize that will cause the ad request to fail immediately. |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#LARGE_BANNER()` Large banner ad size (320x100 density-independent pixels). |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#LEADERBOARD()` Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels). |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#MEDIUM_RECTANGLE()` Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels). |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#SMART_BANNER()` **This property is deprecated.** Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead. <br /> |
| `const https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#WIDE_SKYSCRAPER()` IAB wide skyscraper ad size (160x600 density-independent pixels). |

| ### Public constructors |
|---|
| `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#AdSize(int,int)(width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Creates a new `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize`. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#equals(java.lang.Object)(other: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` Compares this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the specified object and indicates if they are equal. |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `[getCurrentOrientationAnchoredAdaptiveBannerAdSize](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getCurrentOrientationAnchoredAdaptiveBannerAdSize(android.content.Context,int))( context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html )` **This function is deprecated.** Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead. <br /> |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getCurrentOrientationInlineAdaptiveBannerAdSize(android.content.Context,int)( context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html )` Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a height that is always 0. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getHeightInPixels(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Returns the height of this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` in physical pixels. |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getInlineAdaptiveBannerAdSize(int,int)(width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, maxHeight: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a height that is always 0. |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `[getLandscapeAnchoredAdaptiveBannerAdSize](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLandscapeAnchoredAdaptiveBannerAdSize(android.content.Context,int))(context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` **This function is deprecated.** Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeLandscapeAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead. <br /> |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLandscapeInlineAdaptiveBannerAdSize(android.content.Context,int)(context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a height that is always 0. |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeAnchoredAdaptiveBannerAdSize(android.content.Context,int)(context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a Google-optimized height to create a large banner ad. |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeLandscapeAnchoredAdaptiveBannerAdSize(android.content.Context,int)( context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html )` Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a Google-optimized height to create a large banner ad. |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargePortraitAnchoredAdaptiveBannerAdSize(android.content.Context,int)( context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html )` Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a Google-optimized height to create a large banner ad. |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `[getPortraitAnchoredAdaptiveBannerAdSize](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getPortraitAnchoredAdaptiveBannerAdSize(android.content.Context,int))(context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` **This function is deprecated.** Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargePortraitAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead. <br /> |
| `java-static https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getPortraitInlineAdaptiveBannerAdSize(android.content.Context,int)(context: https://developer.android.com/reference/android/content/Context.html!, width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a height that is always 0. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getWidthInPixels(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Returns the width of this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` in physical pixels. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#hashCode()()` |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#isAutoHeight()()` Returns whether this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` is auto-height. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#isFluid()()` Returns whether this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` is of fluid size or not. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#isFullWidth()()` Returns whether this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` is full-width. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#height()` |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#width()` |

## 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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdView` 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!
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead.

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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize`.

| Parameters |
|---|---|
| `width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The width of the ad in density-independent pixels. |
| `height: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The height of the ad in density-independent pixels. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the width or height is negative. |

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

Compares this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the specified object and indicates if they are equal.

### getCurrentOrientationAnchoredAdaptiveBannerAdSize

```
java-static fun [getCurrentOrientationAnchoredAdaptiveBannerAdSize](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getCurrentOrientationAnchoredAdaptiveBannerAdSize(android.content.Context,int))(
    context: Context!,
    width: Int
): AdSize!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead.

Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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, `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` is returned.

| Returns |
|---|---|
| `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | An `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` object. Returns `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/BaseAdView#getAdSize()` inside the `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdListener#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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` in physical pixels. For fluid size, it returns -1.

### getInlineAdaptiveBannerAdSize

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

Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/BaseAdView#getAdSize()` inside the `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdListener#onAdLoaded()` callback. This ad size is most suitable for ads intended to be displayed inside scrollable content.

| Parameters |
|---|---|
| `maxHeight: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | 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](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLandscapeAnchoredAdaptiveBannerAdSize(android.content.Context,int))(context: Context!, width: Int): AdSize!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargeLandscapeAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead.

Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#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, `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` is returned.

| Returns |
|---|---|
| `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | An `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` object. Returns `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/BaseAdView#getAdSize()` inside the `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdListener#onAdLoaded()` callback. This ad size is most suitable for ads intended to be displayed inside scrollable content.

### getLargeAnchoredAdaptiveBannerAdSize

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

Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a Google-optimized height to create a large banner ad. The size returned is suitable for anchoring near the top or bottom of your app. The height is never larger than 20% of the device's current orientation height and is always between 50-150 density-independent pixels. 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, `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` is returned.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html` used to determine device-specific information, such as screen dimensions. |
| `width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The desired width of the ad unit in density-independent pixels. |

| Returns |
|---|---|
| `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | An `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` object. Returns `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` if the context is null or the device height cannot be determined from the context. |

### getLargeLandscapeAnchoredAdaptiveBannerAdSize

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

Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a Google-optimized height to create a large banner ad. The size returned is suitable for use in a banner ad anchored near the top or bottom of your app. The height is never larger than 20% of the device's height in landscape mode and is always between 50-150 density-independent pixels. 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, `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` is returned.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html` used to determine device-specific information, such as screen dimensions. |
| `width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The desired width of the ad unit in density-independent pixels. |

| Returns |
|---|---|
| `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | An `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` object. Returns `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` if the context is null or the device height cannot be determined from the context. |

### getLargePortraitAnchoredAdaptiveBannerAdSize

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

Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` with the given width and a Google-optimized height to create a large banner ad. The size returned is suitable for use in a banner ad anchored near the top or bottom of your app. The height is never larger than 20% of the device's portrait height and is always between 50-150 density-independent pixels. This function always returns the same height for any width / device combination.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html` used to determine device-specific information, such as screen dimensions. |
| `width: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | The desired width of the ad unit in density-independent pixels. |

| Returns |
|---|---|
| `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | An `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` object. Returns `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#INVALID()` if the context is null or the device height cannot be determined from the context. |

### getPortraitAnchoredAdaptiveBannerAdSize

```
java-static fun [getPortraitAnchoredAdaptiveBannerAdSize](https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getPortraitAnchoredAdaptiveBannerAdSize(android.content.Context,int))(context: Context!, width: Int): AdSize!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#getLargePortraitAnchoredAdaptiveBannerAdSize(android.content.Context,int)` instead.

Returns an `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#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 |
|---|---|
| `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize!` | An `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` object. Returns `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize#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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/BaseAdView#getAdSize()` inside the `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdListener#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 `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` in physical pixels. For fluid size, it returns -1.

### hashCode

```
fun hashCode(): Int
```

### isAutoHeight

```
fun isAutoHeight(): Boolean
```

Returns whether this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` is auto-height.

### isFluid

```
fun isFluid(): Boolean
```

Returns whether this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` is of fluid size or not.

### isFullWidth

```
fun isFullWidth(): Boolean
```

Returns whether this `https://developers.google.com/admob/android/reference/kotlin/com/google/android/gms/ads/AdSize` is full-width.

### toString

```
fun toString(): String!
```

## Public properties

### height

```
val height: Int
```

### width

```
val width: Int
```