Added in API level 1

MaskFilterSpan

public class MaskFilterSpan
extends CharacterStyle implements UpdateAppearance

java.lang.Object
   ↳ android.text.style.CharacterStyle
     ↳ android.text.style.MaskFilterSpan


Span that allows setting a MaskFilter to the text it's attached to.

For example, to blur a text, a BlurMaskFilter can be used:

 MaskFilter blurMask = new BlurMaskFilter(5f, BlurMaskFilter.Blur.NORMAL);
 SpannableString string = new SpannableString("Text with blur mask");
 string.setSpan(new MaskFilterSpan(blurMask), 10, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
 
Text blurred with the MaskFilterSpan.

Summary

Public constructors

MaskFilterSpan(MaskFilter filter)

Creates a MaskFilterSpan from a MaskFilter.

Public methods

MaskFilter getMaskFilter()

Return the mask filter for this span.

String toString()

Returns a string representation of the object.

void updateDrawState(TextPaint ds)

Inherited methods

Public constructors

MaskFilterSpan

Added in API level 1
public MaskFilterSpan (MaskFilter filter)

Creates a MaskFilterSpan from a MaskFilter.

Parameters
filter MaskFilter: the filter to be applied to the TextPaint

Public methods

getMaskFilter

Added in API level 1
public MaskFilter getMaskFilter ()

Return the mask filter for this span.

Returns
MaskFilter the mask filter for this span

toString

Added in API level 1
public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

updateDrawState

Added in API level 1
public void updateDrawState (TextPaint ds)

Parameters
ds TextPaint