QuoteSpan


public class QuoteSpan
extends Object implements LeadingMarginSpan, ParcelableSpan

java.lang.Object
   ↳ android.text.style.QuoteSpan


A span which styles paragraphs by adding a vertical stripe at the beginning of the text (respecting layout direction).

A QuoteSpan must be attached from the first character to the last character of a single paragraph, otherwise the span will not be displayed.

QuoteSpans allow configuring the following elements:

  • color - the vertical stripe color. By default, the stripe color is 0xff0000ff
  • gap width - the distance, in pixels, between the stripe and the paragraph. Default value is 2px.
  • stripe width - the width, in pixels, of the stripe. Default value is 2px.
For example, a QuoteSpan using the default values can be constructed like this:
SpannableString string = new SpannableString("Text with quote span on a long line");
string.setSpan(new QuoteSpan(), 0, string.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);