Skip to content

Most visited

Recently visited

navigation
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.

void updateDrawState(TextPaint ds)

Inherited methods

Public constructors

MaskFilterSpan

added in API level 1
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
MaskFilter getMaskFilter ()

Return the mask filter for this span.

Returns
MaskFilter the mask filter for this span

updateDrawState

added in API level 1
void updateDrawState (TextPaint ds)

Parameters
ds TextPaint

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)