public class AdOptionsView
extends com.facebook.ads.internal.api.AdComponentView
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);
Modifier and Type | Class and Description |
---|---|
static class |
AdOptionsView.Orientation |
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.
|
Modifier and Type | Method and Description |
---|---|
void |
setIconColor(int color)
Sets the color of the icons.
|
void |
setIconSizeDp(int iconSizeDp)
Sets the size of the icons in dp.
|
void |
setSingleIcon(boolean singleIcon)
This view displays the ad choices and ad reporting icons by default.
|
public AdOptionsView(Context context, NativeAdBase nativeAdBase, NativeAdLayout nativeAdLayout)
context
- The application context.nativeAdBase
- The native ad base.nativeAdLayout
- The native ad layout.public AdOptionsView(Context context, NativeAdBase nativeAdBase, NativeAdLayout nativeAdLayout, AdOptionsView.Orientation orientation, int iconSizeDp)
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.public void setIconColor(int color)
color
- the color you want to set.public void setIconSizeDp(int iconSizeDp)
iconSizeDp
- Thew new icon size.public void setSingleIcon(boolean singleIcon)
singleIcon
- Whether we should use only one of the icons.