Android SDK Version
  • java.lang.Object
    • FrameLayout
      • com.facebook.ads.internal.api.AdComponentView
        • com.facebook.ads.AdOptionsView

public class AdOptionsView
extends com.facebook.ads.internal.api.AdComponentView
A clickable Ad Options icon, which presents the user with options to report and hide an ad. Should be added to Native Ads to present the users with these options. Create an AdOptionsView by calling: AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout); addView(adOptionsView);
You can define extra params, such as the orientation of the icons in the view and the size of the icons by calling: AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout, orientation, iconSizeDp); addView(adOptionsView);
Please note that there is a minimum size for the icon, set at 23dp.
You can also change the colors and the size of the icon by calling:
AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout); adOptionsView.setIconColor(newColor); adOptionsView.setIconSizeDp(newIconSizeDp); addView(adOptionsView);
Since:
5.1
Nested Class Summary
Modifier and TypeClass and Description
static class AdOptionsView.Orientation 
Constructor Summary
Constructor and Description
AdOptionsView(Context context, NativeAdBase nativeAdBase, NativeAdLayout nativeAdLayout)
Initializes the AdOptionsView with default Horizontal orientation and minimum possible size for the icons.
AdOptionsView(Context context, NativeAdBase nativeAdBase, NativeAdLayout nativeAdLayout, AdOptionsView.Orientation orientation, int iconSizeDp)
Initializes the AdOptionsView with custom orientation and icon size.
Method Summary
Modifier and TypeMethod and Description
voidsetIconColor(int color)
Sets the color of the icons.
voidsetIconSizeDp(int iconSizeDp)
Sets the size of the icons in dp.
voidsetSingleIcon(boolean singleIcon)
This view displays the ad choices and ad reporting icons by default.
Methods inherited from class com.facebook.ads.internal.api.AdComponentView
attachAdComponentViewApi, onAttachedToWindow, onDetachedFromWindow, onMeasure, onVisibilityChanged, onWindowFocusChanged, setLayoutParams
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

AdOptionsView

public AdOptionsView(Context context,
                     NativeAdBase nativeAdBase,
                     NativeAdLayout nativeAdLayout)
Initializes the AdOptionsView with default Horizontal orientation and minimum possible size for the icons.
Parameters:
context - The application context.
nativeAdBase - The native ad base.
nativeAdLayout - The native ad layout.

AdOptionsView

public AdOptionsView(Context context,
                     NativeAdBase nativeAdBase,
                     NativeAdLayout nativeAdLayout,
                     AdOptionsView.Orientation orientation,
                     int iconSizeDp)
Initializes the AdOptionsView with custom orientation and icon size.
Parameters:
context - The application context.
nativeAdBase - The native ad base.
nativeAdLayout - The native ad layout.
orientation - The orientation you want the icons to be in: horizontal or vertical.
iconSizeDp - The required icon size in dp - this will be converted to pixels.
Method Detail

setIconColor

public void setIconColor(int color)
Sets the color of the icons.
Parameters:
color - the color you want to set.

setIconSizeDp

public void setIconSizeDp(int iconSizeDp)
Sets the size of the icons in dp.
Parameters:
iconSizeDp - Thew new icon size.

setSingleIcon

public void setSingleIcon(boolean singleIcon)
This view displays the ad choices and ad reporting icons by default. The click action is the same for both. By calling this method with 'true' we will only display the ad choices icon. This is convenient in layouts where fewer space is available.
Parameters:
singleIcon - Whether we should use only one of the icons.