MediaView

public class MediaView extends FrameLayout

View for displaying native advanced ad media content. Add this view to the layout hierarchy, and register it using NativeAdView.setMediaView(MediaView).

  1. If the returned ad contains a video element, the video will be automatically rendered on this MediaView. In the absence of MediaView, a fallback image will be returned in NativeAd.getImages(). Therefore, to render a video, MediaView must be present in the layout hierarchy, and must be registered.
  2. If the returned ad does not contain a video element and contains images, MediaView will be used to automatically render the image.

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

MediaView(Context context)
Creates the MediaView.
MediaView(Context context, AttributeSet attrs)
Creates the MediaView from an XML layout.
MediaView(Context context, AttributeSet attrs, int defStyleAttr)
Creates the MediaView from an XML layout.
MediaView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Creates the MediaView from an XML layout.

Public Method Summary

MediaContent
getMediaContent()
Returns the MediaContent associated with this media view.
void
setImageScaleType(ImageView.ScaleType scaleType)
Sets the ImageView.ScaleType when image is rendered in MediaView.
void
setMediaContent(MediaContent mediaContent)
Sets the media content to be displayed in the media view.

Inherited Method Summary

Public Constructors

public MediaView (Context context)

Creates the MediaView.

public MediaView (Context context, AttributeSet attrs)

Creates the MediaView from an XML layout.

public MediaView (Context context, AttributeSet attrs, int defStyleAttr)

Creates the MediaView from an XML layout.

public MediaView (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Creates the MediaView from an XML layout.

Public Methods

public MediaContent getMediaContent ()

Returns the MediaContent associated with this media view.

public void setImageScaleType (ImageView.ScaleType scaleType)

Sets the ImageView.ScaleType when image is rendered in MediaView. By default SDK uses ImageView.ScaleType.CENTER_INSIDE scaling type to images rendered in MediaView.

public void setMediaContent (MediaContent mediaContent)

Sets the media content to be displayed in the media view.