Interface Spannable

All Superinterfaces:
CharSequence, Spanned
All Known Subinterfaces:
Editable
All Known Implementing Classes:
PrecomputedText, SpannableString, SpannableStringBuilder

public interface Spannable extends Spanned
This is the interface for text to which markup objects can be attached and detached.
Not all Spannable classes have mutable text; see Editable for that.
  • Field Details

  • Method Details

    • setSpan

      void setSpan(@Nonnull Object span, int start, int end, int flags)
      Attach the specified markup object to the range start…end of the text, or move the object to that range if it was already attached elsewhere. See Spanned for an explanation of what the flags mean. The object can be one that has meaning only within your application, or it can be one that the text system will use to affect text display or behavior. Some noteworthy ones are the subclasses of CharacterStyle and ParagraphStyle, and TextWatcher and SpanWatcher.
      Parameters:
      span - the markup object
      start - the start char index of the span
      end - the end char index of the span
      flags - the flags of the span
    • removeSpan

      void removeSpan(@Nonnull Object span)
      Remove the specified object from the range of text to which it was attached, if any.
      It is OK to remove an object that was never attached in the first place.
      Parameters:
      span - markup object to remove
    • removeSpan

      @Internal default void removeSpan(@Nonnull Object span, int flags)
      Remove the specified object from the range of text to which it was attached, if any.
      It is OK to remove an object that was never attached in the first place.

      See Spanned for an explanation of what the flags mean.

      Parameters:
      span - markup object to remove
      flags - flags