[ Web Proxy ]
URL:
Viewing: https://developer.android.com/reference/android/text/style/MaskFilterSpan [Back]  [Original]

MaskFilterSpan  |  API reference  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]
Stay organized with collections Save and categorize content based on your preferences.
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);
maskfilterspan.png [maskfilterspan.png] 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.

Returns
String a string representation of the object.

updateDrawState

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

Parameters
ds TextPaint

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-08-03 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-03 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page