Class AdSize

  • All Implemented Interfaces:
    java.io.Serializable

    public final class AdSize
    extends com.yandex.mobile.ads.banner.BaseAdSize
    The size of a banner ad.
    See Also:
    Serialized Form
    • Field Detail

      • BANNER_240x400

        @Deprecated
        public static final AdSize BANNER_240x400
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Banner ad size (240x400 density-independent pixels).
      • BANNER_300x250

        @Deprecated
        public static final AdSize BANNER_300x250
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Banner ad size (300x250 density-independent pixels).
      • BANNER_300x300

        @Deprecated
        public static final AdSize BANNER_300x300
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Banner ad size (300x300 density-independent pixels).
      • BANNER_320x50

        @Deprecated
        public static final AdSize BANNER_320x50
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Banner ad size (320x50 density-independent pixels).
      • BANNER_320x100

        @Deprecated
        public static final AdSize BANNER_320x100
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Banner ad size (320x100 density-independent pixels).
      • BANNER_400x240

        @Deprecated
        public static final AdSize BANNER_400x240
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Banner ad size (400x240 density-independent pixels).
      • BANNER_728x90

        @Deprecated
        public static final AdSize BANNER_728x90
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Banner ad size (728x90 density-independent pixels).
      • FULL_SCREEN

        public static final AdSize FULL_SCREEN
        Full screen ad size.
    • Constructor Detail

      • AdSize

        @Deprecated
        public AdSize​(int width,
                      int height)
        Deprecated.
        Use flexible flexibleSize(int, int) or sticky stickySize(int) banners instead of fixed. Fixed AdSize API will be removed starting from version 6.*
        Create a new fixed AdSize.
        Parameters:
        width - The width of the ad in density-independent pixels (dp).
        height - The height of the ad in density-independent pixels (dp).
    • Method Detail

      • flexibleSize

        @NonNull
        public static AdSize flexibleSize​(int width,
                                          int height)
        Returns flexible banner size. Banners with flexible sizes stretch to container width and height when possible.
        Parameters:
        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:
        Flexible banner size.
      • stickySize

        @NonNull
        public static AdSize stickySize​(int width)
        Returns sticky banner size with the given width.
        Parameters:
        width - The width of the ad container in density-independent pixels (dp).
        Returns:
        Sticky banner AdSize.
      • getHeight

        public int getHeight()
        Returns the height of this AdSize in density-independent pixels (dp).
        Overrides:
        getHeight in class com.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 this AdSize in physical pixels. AdSize created with FULL_HEIGHT will return height of the screen.
        Overrides:
        getHeightInPixels in class com.yandex.mobile.ads.banner.BaseAdSize
        Parameters:
        context - Any Context.
        Returns:
        Height in physical pixels.
      • getWidth

        public int getWidth()
        Returns the width of this AdSize in density-independent pixels (dp).
        Overrides:
        getWidth in class com.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 this AdSize in physical pixels. AdSize created with FULL_WIDTH will return width of the screen.
        Overrides:
        getWidthInPixels in class com.yandex.mobile.ads.banner.BaseAdSize
        Parameters:
        context - Any Context.
        Returns:
        Width in physical pixels.
      • getHeight

        public int getHeight​(@NonNull
                             android.content.Context context)
        Returns the actual height of this AdSize in density-independent pixels (dp). AdSize created with FULL_HEIGHT will return height of the screen.
        Overrides:
        getHeight in class com.yandex.mobile.ads.banner.BaseAdSize
        Parameters:
        context - Any Context.
        Returns:
        Weight in density-independent pixels (dp).
      • getWidth

        public int getWidth​(@NonNull
                            android.content.Context context)
        Returns the actual width of this AdSize in density-independent pixels (dp). AdSize created with FULL_WIDTH will return width of the screen.
        Overrides:
        getWidth in class com.yandex.mobile.ads.banner.BaseAdSize
        Parameters:
        context - Any Context.
        Returns:
        Width in density-independent pixels (dp).