NativeAdOptions.Builder

class NativeAdOptions.Builder


NativeAdOptions 的构建器类。

摘要

公共构造函数

公共函数

NativeAdOptions!

使用指定的属性构造 NativeAdOptions 对象。

NativeAdOptions.Builder!

启用滑动作为自定义点击手势。

NativeAdOptions.Builder!

设置“广告选项”图标(如果有)的展示位置。

NativeAdOptions.Builder!

设置媒体宽高比。

NativeAdOptions.Builder!

将此布尔值设置为 true 可请求自定义版“不再显示该广告”功能。

NativeAdOptions.Builder!

设置是否应请求多张图片。

NativeAdOptions.Builder!

设置是否应仅针对图片素材资源返回网址。

NativeAdOptions.Builder!

设置 VideoOptions 对象。

公共构造函数

构建器

Builder()

公共函数

build

fun build(): NativeAdOptions!

使用指定的属性构造 NativeAdOptions 对象。

enableCustomClickGestureDirection

@CanIgnoreReturnValue
fun enableCustomClickGestureDirection(
    @NativeAdOptions.SwipeGestureDirection swipeGestureDirection: Int,
    tapsAllowed: Boolean
): NativeAdOptions.Builder!

启用滑动作为自定义点击手势。

参数
@NativeAdOptions.SwipeGestureDirection swipeGestureDirection: Int

要计为点击的 SwipeGestureDirection

tapsAllowed: Boolean

是否仍应允许将点按视为点击。

仅适用于列入许可名单的发布商。对于未列入许可名单的发布商,系统会忽略这些设置。

setAdChoicesPlacement

@CanIgnoreReturnValue
fun setAdChoicesPlacement(
    @NativeAdOptions.AdChoicesPlacement adChoicesPlacement: Int
): NativeAdOptions.Builder!

设置“广告选项”图标(如果有)的展示位置。该值应为 ADCHOICES_TOP_LEFT、ADCHOICES_TOP_RIGHT、ADCHOICES_BOTTOM_RIGHT 或 ADCHOICES_BOTTOM_LEFT 之一。默认值为 ADCHOICES_TOP_RIGHT。

setMediaAspectRatio

@CanIgnoreReturnValue
fun setMediaAspectRatio(
    @NativeAdOptions.NativeMediaAspectRatio aspectRatio: Int
): NativeAdOptions.Builder!

设置媒体宽高比。

参数
@NativeAdOptions.NativeMediaAspectRatio aspectRatio: Int

要使用某个 NativeMediaAspectRatio 选项设置的宽高比。

setRequestCustomMuteThisAd

@CanIgnoreReturnValue
fun setRequestCustomMuteThisAd(requestCustomMuteThisAd: Boolean): NativeAdOptions.Builder!

将此布尔值设置为 true 可请求自定义版“不再显示该广告”功能。默认值为 false

setRequestMultipleImages

@CanIgnoreReturnValue
fun setRequestMultipleImages(shouldRequestMultipleImages: Boolean): NativeAdOptions.Builder!

设置是否应请求多张图片。默认值为 false。

setReturnUrlsForImageAssets

@CanIgnoreReturnValue
fun setReturnUrlsForImageAssets(shouldReturnUrls: Boolean): NativeAdOptions.Builder!

设置是否应仅返回图片素材资源的网址。如果为 true,SDK 将不会下载图片素材资源,而是返回一个仅填充了 URI 和 Scale 属性的 NativeAd.Image。如果为 false,SDK 会自动下载图片素材资源,并返回一个 NativeAd.Image,其中包含已填充的所有三个属性(URI、缩放比例和 Drawable)。默认值为 false。

setVideoOptions

@CanIgnoreReturnValue
fun setVideoOptions(videoOptions: VideoOptions!): NativeAdOptions.Builder!

设置 VideoOptions 对象。