public class NativeAdView
extends java.lang.Object
NativeAdView
provides a templated View
for a NativeAd
with flexible width
and height determined by the container View. The NativeAdView
will adapt it's elements
according to the dimensions of the ViewGroup
where it is placed. However, the recommended
dimensions for the NativeAdView
are: - width: 280dp - 500dp - height: 250dp - 500dp The
NativeAdView
will not be able to render the MediaView
if the height is less than
250dp, and an impression will not be logged in this scenario. An optional NativeAdViewAttributes
object can customize the template View
.Modifier and Type | Class and Description |
---|---|
static class |
NativeAdView.Type
Deprecated.
|
Constructor and Description |
---|
NativeAdView() |
Modifier and Type | Method and Description |
---|---|
static View |
render(Context context,
NativeAd nativeAd)
Creates a
View for the given NativeAd . |
static View |
render(Context context,
NativeAd nativeAd,
NativeAdView.Type type)
Deprecated.
|
static View |
render(Context context,
NativeAd nativeAd,
NativeAdView.Type type,
NativeAdViewAttributes attributes)
Deprecated.
|
static View |
render(Context context,
NativeAd nativeAd,
NativeAdViewAttributes attributes)
Creates a
View for the given NativeAd . |
public static View render(Context context, NativeAd nativeAd)
View
for the given NativeAd
. This View will use the default colours
and fonts.public static View render(Context context, NativeAd nativeAd, NativeAdViewAttributes attributes)
View
for the given NativeAd
. This View will use the colours and fonts
supplied in the NativeAdViewAttributes
object.context
- Android Context
object.nativeAd
- NativeAd
for which we create the template View
.attributes
- optional NativeAdViewAttributes
specification.View
for the given NativeAd
@Deprecated public static View render(Context context, NativeAd nativeAd, NativeAdView.Type type)
View
for specified NativeAdView.Type
.context
- Android Context
object.nativeAd
- NativeAd
for which we create the template View
.type
- NativeAdView.Type
that specifies a template.View
.java.lang.IllegalStateException
- If any of arguments is null.@Deprecated public static View render(Context context, NativeAd nativeAd, NativeAdView.Type type, NativeAdViewAttributes attributes)
context
- Android Context
object.nativeAd
- NativeAd
for which we create the template View
.type
- NativeAdView.Type
that specifies a template.attributes
- optional NativeAdViewAttributes
specification.View
.java.lang.IllegalStateException
- If any of mandatory arguments is null.