Class NativeBannerView

com.yandex.mobile.ads.nativeads.template

java.lang.Object ⇽ NativeBannerView

public class NativeBannerView

This class is a template for displaying native ads.

The template appearance (font, background color, margins) is set using the #applyAppearance(NativeTemplateAppearance) method.

Constructors

NativeBannerView(final Context context)

Constructor for programmatically creating an object of the NativeBannerView class.

NativeBannerView(final Context context, final AttributeSet attrs)

Creates an object of the NativeBannerView class from an XML file.

NativeBannerView(final Context context, final AttributeSet attrs, final int defStyleAttr)

Creates an object of the NativeBannerView class from an XML file.

Methods

void applyAppearance(@Nullable final NativeTemplateAppearance templateAppearance)

Changes the appearance of the native ad template.

void onAttachedToWindow()
void onDetachedFromWindow()
void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec)
void setAd(final NativeGenericAd nativeAd)

Specifies an object of the NativeGenericAd class with the native ad content.

Constructor Detail

NativeBannerView

public NativeBannerView (final Context context)

Constructor for programmatically creating an object of the NativeBannerView class.

Parameters:
context

An object of the Context system class.

NativeBannerView

public NativeBannerView (final Context context, final AttributeSet attrs)

Creates an object of the NativeBannerView class from an XML file.

Parameters:
context

An object of the Context system class.

attrs

Attributes that are defined when creating the NativeBannerView object via a representation in an XML file.

NativeBannerView

public NativeBannerView (final Context context, final AttributeSet attrs, final int defStyleAttr)

Creates an object of the NativeBannerView class from an XML file.

Parameters:
context

An object of the Context system class.

attrs

Attributes that are defined when creating the NativeBannerView object via a representation in an XML file.

defStyleAttr

An attribute that contains a reference to a style resource for view. The default values are described in the resource. The default values are described in the resource.

Method Detail

applyAppearance

public void applyAppearance (@Nullable final NativeTemplateAppearance templateAppearance)

Changes the appearance of the native ad template.

Parameters:
templateAppearance

An object of the NativeTemplateAppearance class.

onAttachedToWindow

protected void onAttachedToWindow ()

onDetachedFromWindow

protected void onDetachedFromWindow ()

onMeasure

protected void onMeasure (final int widthMeasureSpec, final int heightMeasureSpec)

setAd

public void setAd (final NativeGenericAd nativeAd)

Specifies an object of the NativeGenericAd class with the native ad content.

Parameters:
nativeAd

An object of the NativeGenericAd class.