NativeAdView

public final classNativeAdViewextendsFrameLayout

Root view forNativeAd.

XML layout files for native ads should useNativeAdViewas the root element for their native assets, and dynamically created views that will contain native ad assets should use an instance of this class as their rootViewGroup.

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

NativeAdView(Context context)
Constructs aNativeAdView from code.
NativeAdView(Context context,AttributeSet attrs)
Constructs aNativeAdView from an XML layout.
NativeAdView(Context context,AttributeSet attrs, int defStyleAttr)
Constructs aNativeAdView from an XML layout.
NativeAdView(Context context,AttributeSet attrs, int defStyleAttr, int defStyleRes)
Constructs aNativeAdView from an XML layout.

Public Method Summary

void
destroy()
Destroys the native ad view.
AdChoicesView
getAdChoicesView()
Returns the view associated with AdChoices content.
View
getAdvertiserView()
Returns the view associated with the advertiser asset.
View
getBodyView()
Returns the view associated with the body asset.
View
getCallToActionView()
Returns the view associated with the call to action asset.
View
getHeadlineView()
Returns the view associated with the headline asset.
View
getIconView()
Returns the view associated with the icon asset.
View
getImageView()
Returns the view associated with the image asset.
MediaView
getMediaView()
Returns the view associated with the media content.
View
getPriceView()
Returns the view associated with the price asset.
View
getStarRatingView()
Returns the view associated with the star rating asset.
View
getStoreView()
Returns the view associated with the store asset.
void
setAdChoicesView(AdChoicesView adChoicesView)
Sets anAdChoicesView for displaying AdChoices content.
void
setAdvertiserView(Viewview)
Sets a view for the advertiser asset.
void
setBodyView(Viewview)
Sets a view for the body asset.
void
setCallToActionView(Viewview)
Sets a view for the call to action asset.
void
setClickConfirmingView(Viewview)
Sets theViewthat users will use to confirm their clickthroughs.
void
setHeadlineView(Viewview)
Sets a view for the headline asset.
void
setIconView(Viewview)
Sets a view for the icon asset.
void
setImageView(Viewview)
Sets a view for the image asset.
void
setMediaView(MediaView view)
Sets a media view for media content.
void
setNativeAd(NativeAd ad)
Sets theNativeAd that this view is currently displaying.
void
setPriceView(Viewview)
Sets a view for the price asset.
void
setStarRatingView(Viewview)
Sets a view for the star rating asset.
void
setStoreView(Viewview)
Sets a view for the store asset.

Inherited Method Summary

Public Constructors

publicNativeAdView(Context context)

Constructs aNativeAdView from code.

Parameters
context TheContext in which theNativeAdView is running.

publicNativeAdView(Contextcontext, AttributeSet attrs)

Constructs aNativeAdView from an XML layout.

publicNativeAdView(Contextcontext, AttributeSet attrs, int defStyleAttr)

Constructs aNativeAdView from an XML layout.

publicNativeAdView(Contextcontext, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Constructs aNativeAdView from an XML layout.

Public Methods

public voiddestroy()

Destroys the native ad view. No other methods should be called on the ad view after destroy() is called.

publicAdChoicesView getAdChoicesView()

Returns the view associated with AdChoices content.

publicViewgetAdvertiserView()

Returns the view associated with the advertiser asset.

publicViewgetBodyView()

Returns the view associated with the body asset.

publicViewgetCallToActionView()

Returns the view associated with the call to action asset.

publicViewgetHeadlineView()

Returns the view associated with the headline asset.

publicViewgetIconView()

Returns the view associated with the icon asset.

publicViewgetImageView()

Returns the view associated with the image asset.

publicMediaView getMediaView()

Returns the view associated with the media content.

publicViewgetPriceView()

Returns the view associated with the price asset.

publicViewgetStarRatingView()

Returns the view associated with the star rating asset.

publicViewgetStoreView()

Returns the view associated with the store asset.

public voidsetAdChoicesView(AdChoicesView adChoicesView)

Sets anAdChoicesView for displaying AdChoices content.

Parameters
adChoicesView TheAdChoicesView to set

public voidsetAdvertiserView(Viewview)

Sets a view for the advertiser asset.

Parameters
view The view to set

public voidsetBodyView(Viewview)

Sets a view for the body asset.

Parameters
view The view to set

public voidsetCallToActionView(Viewview)

Sets a view for the call to action asset.

Parameters
view The view to set

public voidsetClickConfirmingView(Viewview)

Sets theViewthat users will use to confirm their clickthroughs.

Parameters
view TheViewto set.

public voidsetHeadlineView(Viewview)

Sets a view for the headline asset.

Parameters
view The view to set

public voidsetIconView(Viewview)

Sets a view for the icon asset.

Parameters
view The view to set

public voidsetImageView(Viewview)

Sets a view for the image asset.

Parameters
view The view to set

public voidsetMediaView(MediaView view)

Sets a media view for media content.

Parameters
view TheMediaView to set

public voidsetNativeAd(NativeAd ad)

Sets theNativeAd that this view is currently displaying.

Parameters
ad the native ad that the view is currently displaying

public voidsetPriceView(Viewview)

Sets a view for the price asset.

Parameters
view The view to set

public voidsetStarRatingView(Viewview)

Sets a view for the star rating asset.

Parameters
view The view to set

public voidsetStoreView(Viewview)

Sets a view for the store asset.

Parameters
view The view to set