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.SerializableThe size of a banner ad.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static BannerAdSizefixedSize(android.content.Context context, int width, int height)Returns fixed banner size.intgetHeight()Returns the height of thisBannerAdSizein density-independent pixels (dp).intgetHeight(android.content.Context context)Returns the actual height of thisBannerAdSizein density-independent pixels (dp).intgetHeightInPixels(android.content.Context context)Returns the actual height of thisBannerAdSizein physical pixels.intgetWidth()Returns the width of thisBannerAdSizein density-independent pixels (dp).intgetWidth(android.content.Context context)Returns the actual width of thisBannerAdSizein density-independent pixels (dp).intgetWidthInPixels(android.content.Context context)Returns the actual width of thisBannerAdSizein physical pixels.inthashCode()static BannerAdSizeinlineSize(android.content.Context context, int width, int maxHeight)Returns inline adaptive banner size.static BannerAdSizestickySize(android.content.Context context, int width)Returns sticky banner size with the given width.java.lang.StringtoString()
-
-
-
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 thisBannerAdSizein 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 thisBannerAdSizein 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 thisBannerAdSizein 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 thisBannerAdSizein 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 thisBannerAdSizein 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 thisBannerAdSizein 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-