Class LineBackgroundSpan.Standard

java.lang.Object
icyllis.modernui.text.style.LineBackgroundSpan.Standard
All Implemented Interfaces:
ParcelableSpan, LineBackgroundSpan, ParagraphStyle, Parcelable
Enclosing interface:
LineBackgroundSpan

public static class LineBackgroundSpan.Standard extends Object implements LineBackgroundSpan, ParcelableSpan
Default implementation of the LineBackgroundSpan, which changes the background color of the lines to which the span is attached.
  • Constructor Details

    • Standard

      public Standard(@ColorInt int color)
      Constructor taking a color integer.
      Parameters:
      color - Color integer that defines the background color.
    • Standard

      public Standard(@NonNull Parcel src)
      Creates a LineBackgroundSpan.Standard from a parcel
  • Method Details

    • getSpanTypeId

      public int getSpanTypeId()
      Description copied from interface: ParcelableSpan
      Return a special type identifier for this span class.
      Specified by:
      getSpanTypeId in interface ParcelableSpan
    • writeToParcel

      public void writeToParcel(@NonNull Parcel dest, int flags)
      Description copied from interface: Parcelable
      The subclass implements the method to flatten its contents by calling the methods of Parcel for its primitive values.
      Specified by:
      writeToParcel in interface Parcelable
      Parameters:
      dest - the parcel to write the object's data to
      flags - the flags about how the object should be written
    • getColor

      @ColorInt public final int getColor()
      Returns:
      the color of this span.
      See Also:
    • drawBackground

      public void drawBackground(@NonNull Canvas canvas, @NonNull Paint paint, int left, int right, int top, int baseline, int bottom, @NonNull CharSequence text, int start, int end, int lineNumber)
      Description copied from interface: LineBackgroundSpan
      Draw the background on the canvas.
      Specified by:
      drawBackground in interface LineBackgroundSpan
      Parameters:
      canvas - canvas on which the span should be rendered
      paint - paint used to draw text, which should be left unchanged on exit
      left - left position of the line relative to input canvas, in pixels
      right - right position of the line relative to input canvas, in pixels
      top - top position of the line relative to input canvas, in pixels
      baseline - baseline of the text relative to input canvas, in pixels
      bottom - bottom position of the line relative to input canvas, in pixels
      text - current text
      start - start character index of the line
      end - end character index of the line
      lineNumber - line number in the current text layout