AdChoicesView 在 Facebook 广告中弃用任何替代品
AdChoicesView deprecated in Facebook ads any replacement
在 Facebook 广告中弃用 AdChoicesView 任何替代品
import com.facebook.ads.AdChoicesView;
AdChoicesView adChoicesView = new AdChoicesView(context, nativeAd, true);
viewHolder.adChoice = adChoicesView;
viewHolder.nativeadview.addView(adChoicesView, 0);
根据 AdChoicesView 的 Facebook 文档:
Deprecated. since 5.1
@Deprecated public class AdChoicesView extends RelativeLayout
Please use AdOptionsView instead. An expandable, clickable ad choices
icon. Can be added to a custom NativeAd view to signify ad content.
替换为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.
您可以像下面这样创建 AdOptionsView
:
AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout);
addView(adOptionsView);
您可以定义额外的参数,例如视图中图标的方向和图标的大小,例如:
AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout, orientation, iconSizeDp);
addView(adOptionsView);
要更改图标的颜色和大小:
AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout);
adOptionsView.setIconColor(newColor);
adOptionsView.setIconSizeDp(newIconSizeDp);
addView(adOptionsView);
以上参数为:
context
- 应用程序上下文。
nativeAdBase
- 原生广告库。
nativeAdLayout
- 原生广告布局。
orientation
- 您希望图标的方向:水平或垂直。
iconSizeDp
- 以 dp 为单位的所需图标大小 - 这将转换为像素。
在 Facebook 广告中弃用 AdChoicesView 任何替代品
import com.facebook.ads.AdChoicesView;
AdChoicesView adChoicesView = new AdChoicesView(context, nativeAd, true);
viewHolder.adChoice = adChoicesView;
viewHolder.nativeadview.addView(adChoicesView, 0);
根据 AdChoicesView 的 Facebook 文档:
Deprecated. since 5.1
@Deprecated public class AdChoicesView extends RelativeLayout
Please use AdOptionsView instead. An expandable, clickable ad choices icon. Can be added to a custom NativeAd view to signify ad content.
替换为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.
您可以像下面这样创建 AdOptionsView
:
AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout);
addView(adOptionsView);
您可以定义额外的参数,例如视图中图标的方向和图标的大小,例如:
AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout, orientation, iconSizeDp);
addView(adOptionsView);
要更改图标的颜色和大小:
AdOptionsView adOptionsView = new AdOptionsView(context, nativeAdBase, nativeAdLayout);
adOptionsView.setIconColor(newColor);
adOptionsView.setIconSizeDp(newIconSizeDp);
addView(adOptionsView);
以上参数为:
context
- 应用程序上下文。
nativeAdBase
- 原生广告库。
nativeAdLayout
- 原生广告布局。
orientation
- 您希望图标的方向:水平或垂直。
iconSizeDp
- 以 dp 为单位的所需图标大小 - 这将转换为像素。