Android SDK Version
  • java.lang.Object
    • com.facebook.ads.NativeAdView

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.
Since:
4.6
Nested Class Summary
Modifier and TypeClass and Description
static class NativeAdView.Type
Deprecated. 
Constructor Summary
Constructor and Description
NativeAdView() 
Method Summary
Modifier and TypeMethod and Description
static Viewrender(Context context, NativeAd nativeAd)
Creates a View for the given NativeAd.
static Viewrender(Context context, NativeAd nativeAd, NativeAdView.Type type)
Deprecated. 
static Viewrender(Context context, NativeAd nativeAd, NativeAdView.Type type, NativeAdViewAttributes attributes)
Deprecated. 
static Viewrender(Context context, NativeAd nativeAd, NativeAdViewAttributes attributes)
Creates a View for the given NativeAd.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

NativeAdView

public NativeAdView()
Method Detail

render

public static View render(Context context,
                          NativeAd nativeAd)
Creates a View for the given NativeAd. This View will use the default colours and fonts.
Parameters:
context - Android Context object.
nativeAd - NativeAd for which we create the template View.
Returns:
A View for the given NativeAd

render

public static View render(Context context,
                          NativeAd nativeAd,
                          NativeAdViewAttributes attributes)
Creates a View for the given NativeAd. This View will use the colours and fonts supplied in the NativeAdViewAttributes object.
Parameters:
context - Android Context object.
nativeAd - NativeAd for which we create the template View.
attributes - optional NativeAdViewAttributes specification.
Returns:
A View for the given NativeAd

render

@Deprecated
public static View render(Context context,
                                      NativeAd nativeAd,
                                      NativeAdView.Type type)
Deprecated. 
Allows to create View for specified NativeAdView.Type.
Parameters:
context - Android Context object.
nativeAd - NativeAd for which we create the template View.
type - NativeAdView.Type that specifies a template.
Returns:
A templated View.
Throws:
java.lang.IllegalStateException - If any of arguments is null.
Since:
4.6

render

@Deprecated
public static View render(Context context,
                                      NativeAd nativeAd,
                                      NativeAdView.Type type,
                                      NativeAdViewAttributes attributes)
Deprecated. 
Allows to create View for specified NativeAdView.Type and NativeAdViewAttributes.
Parameters:
context - Android Context object.
nativeAd - NativeAd for which we create the template View.
type - NativeAdView.Type that specifies a template.
attributes - optional NativeAdViewAttributes specification.
Returns:
A templated View.
Throws:
java.lang.IllegalStateException - If any of mandatory arguments is null.
Since:
4.6