Package com.yandex.mobile.ads.banner
Class BannerAdSize
- java.lang.Object
-
- com.yandex.mobile.ads.banner.BannerAdSize
-
- All Implemented Interfaces:
java.io.Serializable
public final class BannerAdSize extends java.lang.Object implements java.io.Serializable
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 boolean
equals(java.lang.Object o)
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.int
hashCode()
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.java.lang.String
toString()
-
-
-
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).- 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.- Parameters:
context
- AnyContext
.- Returns:
- Height in physical pixels.
-
getWidth
public int getWidth()
Returns the width of thisBannerAdSize
in density-independent pixels (dp).- 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.- 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.- 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.- Parameters:
context
- AnyContext
.- Returns:
- Width in density-independent pixels (dp).
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-