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

public class NativeAdViewAttributes
extends java.lang.Object
NativeAdViewAttributes controls layout and display elements of the NativeAdView. The attributes object must be created and fully initialized at NativeAdView creation time, changes to the attributes object after NativeAdView creation will not propagate to the view. Usage: NativeAdViewAttributes attributes = new NativeAdViewAttributes(mContext) .setBackgroundColor(mAdBackgroundColor) .setTitleTextColor(mTitleColor) .setDescriptionTextColor(mContentColor) .setButtonBorderColor(mCtaTextColor) .setButtonTextColor(mCtaTextColor) .setButtonColor(mCtaBgColor); View adView = NativeAdView.render(activity, mNativeAd, mViewType, attributes);
Since:
4.6
Constructor Summary
Constructor and Description
NativeAdViewAttributes()
Deprecated. 
NativeAdViewAttributes(Context context)
Create NativeAdViewAttributes.
Method Summary
Modifier and TypeMethod and Description
booleangetAutoplay()
Deprecated. 
booleangetAutoplayOnMobile()
Deprecated. 
intgetBackgroundColor()
Deprecated. 
intgetButtonBorderColor()
Deprecated. 
intgetButtonColor()
Deprecated. 
intgetButtonTextColor()
Deprecated. 
intgetDescriptionTextColor()
Deprecated. 
intgetDescriptionTextSize()
Deprecated. 
com.facebook.ads.internal.api.NativeAdViewAttributesApigetInternalAttributes()
Used by other SDK classes and subject to change.
intgetTitleTextColor()
Deprecated. 
intgetTitleTextSize()
Deprecated. 
TypefacegetTypeface()
Deprecated. 
NativeAdViewAttributessetAutoplay(boolean autoplay)
Deprecated. 
NativeAdViewAttributessetAutoplayOnMobile(boolean autoplay)
Deprecated. 
NativeAdViewAttributessetBackgroundColor(int backgroundColor)
The color that will be used as background for the whole Ad View.
NativeAdViewAttributessetButtonBorderColor(int buttonBorderColor)
The color for the border of the CTA button.
NativeAdViewAttributessetButtonColor(int buttonColor)
The background color of the CTA button.
NativeAdViewAttributessetButtonTextColor(int buttonTextColor)
The text color of the CTA button.
NativeAdViewAttributessetDescriptionTextColor(int descriptionTextColor)
The color that will be used for all text fields except the title and the CTA button.
NativeAdViewAttributessetTitleTextColor(int titleTextColor)
The color that will be used for the Ad Title and AdOptionsView.
NativeAdViewAttributessetTypeface(Typeface typeface)
Sets the Typeface for all text in the Ad View.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

NativeAdViewAttributes

public NativeAdViewAttributes(Context context)
Create NativeAdViewAttributes.
Since:
5.3

NativeAdViewAttributes

@Deprecated
public NativeAdViewAttributes()
Deprecated. use NativeAdViewAttributes(Context) instead.
Create NativeAdViewAttributes.
Since:
4.6
Method Detail

getInternalAttributes

public com.facebook.ads.internal.api.NativeAdViewAttributesApi getInternalAttributes()
Used by other SDK classes and subject to change.

setTypeface

public NativeAdViewAttributes setTypeface(Typeface typeface)
Sets the Typeface for all text in the Ad View.
Parameters:
typeface - The Typeface to set.
Returns:
The NativeAdViewAttributes to continue setting parameters.
Since:
4.6

setBackgroundColor

public NativeAdViewAttributes setBackgroundColor(int backgroundColor)
The color that will be used as background for the whole Ad View.
Parameters:
backgroundColor - The color to set.
Returns:
The NativeAdViewAttributes to continue setting parameters.
Since:
4.6

setTitleTextColor

public NativeAdViewAttributes setTitleTextColor(int titleTextColor)
The color that will be used for the Ad Title and AdOptionsView. Title and Ad Options use the same color because they are rendered next to each other over the same background.
Parameters:
titleTextColor - The color to set.
Returns:
The NativeAdViewAttributes to continue setting parameters.
Since:
4.6

setDescriptionTextColor

public NativeAdViewAttributes setDescriptionTextColor(int descriptionTextColor)
The color that will be used for all text fields except the title and the CTA button. We recommend this color to not be as prominent as the title color when rendered on top of the background. For example, with a WHITE background and BLACK title, a LIGHT_GRAY would be a good option for this field.
Parameters:
descriptionTextColor - The color to set.
Returns:
The NativeAdViewAttributes to continue setting parameters.
Since:
4.6

setButtonColor

public NativeAdViewAttributes setButtonColor(int buttonColor)
The background color of the CTA button.
Parameters:
buttonColor - The color to set.
Returns:
The NativeAdViewAttributes to continue setting parameters.
Since:
4.6

setButtonTextColor

public NativeAdViewAttributes setButtonTextColor(int buttonTextColor)
The text color of the CTA button. Make sure the text is visible given the background color for the button.
Parameters:
buttonTextColor - The color to set.
Returns:
The NativeAdViewAttributes to continue setting parameters.
Since:
4.6

setButtonBorderColor

public NativeAdViewAttributes setButtonBorderColor(int buttonBorderColor)
The color for the border of the CTA button. If you don't want to set a border, use the same color as the background of the button or 0 (Color.TRANSPARENT);
Parameters:
buttonBorderColor -
Returns:
The NativeAdViewAttributes to continue setting parameters.
Since:
4.6

setAutoplayOnMobile

@Deprecated
public NativeAdViewAttributes setAutoplayOnMobile(boolean autoplay)
Deprecated. 

setAutoplay

@Deprecated
public NativeAdViewAttributes setAutoplay(boolean autoplay)
Deprecated. 

getAutoplay

@Deprecated
public boolean getAutoplay()
Deprecated. 

getAutoplayOnMobile

@Deprecated
public boolean getAutoplayOnMobile()
Deprecated. 

getTypeface

@Deprecated
public Typeface getTypeface()
Deprecated. 

getBackgroundColor

@Deprecated
public int getBackgroundColor()
Deprecated. 

getTitleTextColor

@Deprecated
public int getTitleTextColor()
Deprecated. 

getDescriptionTextColor

@Deprecated
public int getDescriptionTextColor()
Deprecated. 

getButtonColor

@Deprecated
public int getButtonColor()
Deprecated. 

getButtonTextColor

@Deprecated
public int getButtonTextColor()
Deprecated. 

getButtonBorderColor

@Deprecated
public int getButtonBorderColor()
Deprecated. 

getTitleTextSize

@Deprecated
public int getTitleTextSize()
Deprecated. 

getDescriptionTextSize

@Deprecated
public int getDescriptionTextSize()
Deprecated.