Added in API level 1

MaskFilterSpan


open class MaskFilterSpan : CharacterStyle, UpdateAppearance

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

For example, to blur a text, a android.graphics.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

Creates a MaskFilterSpan from a MaskFilter.

Public methods
open MaskFilter!

Return the mask filter for this span.

open String

open Unit

Inherited functions
CharacterStyle! getUnderlying()

Returns "this" for most CharacterStyles, but for CharacterStyles that were generated by wrap, returns the underlying CharacterStyle.

CharacterStyle! wrap(cs: CharacterStyle!)

A given CharacterStyle can only applied to a single region of a given Spanned. If you need to attach the same CharacterStyle to multiple regions, you can use this method to wrap it with a new object that will have the same effect but be a distinct object so that it can also be attached without conflict.

Public constructors

MaskFilterSpan

Added in API level 1
MaskFilterSpan(filter: MaskFilter!)

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
open fun getMaskFilter(): MaskFilter!

Return the mask filter for this span.

Return
MaskFilter! the mask filter for this span

toString

Added in API level 1
open fun toString(): String
Return
String a string representation of the object.

updateDrawState

Added in API level 1
open fun updateDrawState(ds: TextPaint!): Unit