Package com.yandex.mobile.ads.banner
Class BannerAdSize
- java.lang.Object
-
- com.yandex.mobile.ads.banner.BaseAdSize
-
- com.yandex.mobile.ads.banner.BannerAdSize
-
- All Implemented Interfaces:
java.io.Serializable
public final class BannerAdSize extends com.yandex.mobile.ads.banner.BaseAdSize
The size of a banner ad.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BannerAdSize
fixedSize(android.content.Context context, int width, int height)
Returns fixed banner size.int
getHeight()
Returns the height of thisBannerAdSize
in density-independent pixels (dp).int
getHeight(android.content.Context context)
Returns the actual height of thisBannerAdSize
in density-independent pixels (dp).int
getHeightInPixels(android.content.Context context)
Returns the actual height of thisBannerAdSize
in physical pixels.int
getWidth()
Returns the width of thisBannerAdSize
in density-independent pixels (dp).int
getWidth(android.content.Context context)
Returns the actual width of thisBannerAdSize
in density-independent pixels (dp).int
getWidthInPixels(android.content.Context context)
Returns the actual width of thisBannerAdSize
in physical pixels.static BannerAdSize
inlineSize(android.content.Context context, int width, int maxHeight)
Returns inline adaptive banner size.static BannerAdSize
stickySize(android.content.Context context, int width)
Returns sticky banner size with the given width.
-
-
-
Method Detail
-
fixedSize
@NonNull public static BannerAdSize fixedSize(@NonNull android.content.Context context, int width, int height)
Returns fixed banner size.- Parameters:
context
- TheContext
.width
- The width of the ad container in density-independent pixels (dp).height
- The height of the ad container in density-independent pixels (dp).- Returns:
- Fixed banner size.
The method is available for internal sdk logic.
We do not recommend using a banner of this size, its use in the application may negatively affect monetization.
Use
stickySize(Context, int)
for small automatically updated banner attached to the the top or bottom of the screen, or useinlineSize(Context, int, int)
for adaptive banner placed in scrolling content.
-
stickySize
@NonNull public static BannerAdSize stickySize(@NonNull android.content.Context context, int width)
Returns sticky banner size with the given width.- Parameters:
context
- TheContext
.width
- The width of the ad container in density-independent pixels (dp).- Returns:
- Sticky banner AdSize.
-
inlineSize
@NonNull public static BannerAdSize inlineSize(@NonNull android.content.Context context, int width, int maxHeight)
Returns inline adaptive banner size. Banners with inline sizes stretch to container width and height when possible.- Parameters:
width
- The width of the ad container in density-independent pixels (dp).maxHeight
- The maximum height of the ad container in density-independent pixels (dp).- Returns:
- Inline banner size.
-
getHeight
public int getHeight()
Returns the height of thisBannerAdSize
in density-independent pixels (dp).- Overrides:
getHeight
in classcom.yandex.mobile.ads.banner.BaseAdSize
- Returns:
- Height in density-independent pixels (dp).
-
getHeightInPixels
public int getHeightInPixels(@NonNull android.content.Context context)
Returns the actual height of thisBannerAdSize
in physical pixels. AdSize created with FULL_HEIGHT will return height of the screen.- Overrides:
getHeightInPixels
in classcom.yandex.mobile.ads.banner.BaseAdSize
- Parameters:
context
- AnyContext
.- Returns:
- Height in physical pixels.
-
getWidth
public int getWidth()
Returns the width of thisBannerAdSize
in density-independent pixels (dp).- Overrides:
getWidth
in classcom.yandex.mobile.ads.banner.BaseAdSize
- Returns:
- Width in density-independent pixels (dp).
-
getWidthInPixels
public int getWidthInPixels(@NonNull android.content.Context context)
Returns the actual width of thisBannerAdSize
in physical pixels. AdSize created with FULL_WIDTH will return width of the screen.- Overrides:
getWidthInPixels
in classcom.yandex.mobile.ads.banner.BaseAdSize
- Parameters:
context
- AnyContext
.- Returns:
- Width in physical pixels.
-
getHeight
public int getHeight(@NonNull android.content.Context context)
Returns the actual height of thisBannerAdSize
in density-independent pixels (dp). AdSize created with FULL_HEIGHT will return height of the screen.- Overrides:
getHeight
in classcom.yandex.mobile.ads.banner.BaseAdSize
- Parameters:
context
- AnyContext
.- Returns:
- Weight in density-independent pixels (dp).
-
getWidth
public int getWidth(@NonNull android.content.Context context)
Returns the actual width of thisBannerAdSize
in density-independent pixels (dp). AdSize created with FULL_WIDTH will return width of the screen.- Overrides:
getWidth
in classcom.yandex.mobile.ads.banner.BaseAdSize
- Parameters:
context
- AnyContext
.- Returns:
- Width in density-independent pixels (dp).
-
-