QuoteSpan
open class QuoteSpan : LeadingMarginSpan, ParcelableSpan
| kotlin.Any | |
| ↳ | 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.
QuoteSpan using the default values can be constructed like this: 
    <code>SpannableString string = new SpannableString("Text with quote span on a long line"); string.setSpan(new QuoteSpan(), 0, string.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>
QuoteSpan constructed with default values. 
    
 To construct a QuoteSpan with a green stripe, of 20px in width and a gap width of 40px: 
<code>SpannableString string = new SpannableString("Text with quote span on a long line"); string.setSpan(new QuoteSpan(Color.GREEN, 20, 40), 0, string.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>
QuoteSpan.
    Summary
| Constants | |
|---|---|
| static Int | Default color for the quote stripe. | 
| static Int | Default gap width in pixels. | 
| static Int | Default stripe width in pixels. | 
| Public constructors | |
|---|---|
| Creates a  | |
| Create a  | |
| Creates a  | |
| Creates a  | |
| Public methods | |
|---|---|
| open Int | |
| open Unit | drawLeadingMargin(c: Canvas, p: Paint, x: Int, dir: Int, top: Int, baseline: Int, bottom: Int, text: CharSequence, start: Int, end: Int, first: Boolean, layout: Layout)Renders the leading margin. | 
| open Int | getColor()Get the color of the quote stripe. | 
| open Int | Get the width of the gap between the stripe and the text. | 
| open Int | getLeadingMargin(first: Boolean) | 
| open Int | |
| open Int | Get the width of the quote stripe. | 
| open String | toString() | 
| open Unit | writeToParcel(dest: Parcel, flags: Int) | 
Constants
STANDARD_COLOR
static val STANDARD_COLOR: Int
Default color for the quote stripe.
Value: -16776961STANDARD_GAP_WIDTH_PX
static val STANDARD_GAP_WIDTH_PX: Int
Default gap width in pixels.
Value: 2STANDARD_STRIPE_WIDTH_PX
static val STANDARD_STRIPE_WIDTH_PX: Int
Default stripe width in pixels.
Value: 2Public constructors
QuoteSpan
QuoteSpan(src: Parcel)
Create a QuoteSpan from a parcel.
| Parameters | |
|---|---|
| src | Parcel: This value cannot be null. | 
QuoteSpan
QuoteSpan(color: Int)
Creates a QuoteSpan based on a color.
| Parameters | |
|---|---|
| color | Int: the color of the quote stripe. | 
QuoteSpan
QuoteSpan(
color: Int,
stripeWidth: Int,
gapWidth: Int)
Creates a QuoteSpan based on a color, a stripe width and the width of the gap between the stripe and the text.
| Parameters | |
|---|---|
| color | Int: the color of the quote stripe. | 
| stripeWidth | Int: the width of the stripe. Value is 0 or greater | 
| gapWidth | Int: the width of the gap between the stripe and the text. Value is 0 or greater | 
Public methods
describeContents
open fun describeContents(): Int
| Return | |
|---|---|
| Int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0orandroid.os.Parcelable#CONTENTS_FILE_DESCRIPTOR | 
drawLeadingMargin
open fun drawLeadingMargin(
c: Canvas,
p: Paint,
x: Int,
dir: Int,
top: Int,
baseline: Int,
bottom: Int,
text: CharSequence,
start: Int,
end: Int,
first: Boolean,
layout: Layout
): Unit
Renders the leading margin. This is called before the margin has been adjusted by the value returned by getLeadingMargin(boolean).
| Parameters | |
|---|---|
| c | Canvas: This value cannot be null. | 
| p | Paint: This value cannot be null. | 
| x | Int: the current position of the margin | 
| dir | Int: the base direction of the paragraph; if negative, the margin is to the right of the text, otherwise it is to the left. | 
| top | Int: the top of the line | 
| baseline | Int: the baseline of the line | 
| bottom | Int: the bottom of the line | 
| text | CharSequence: This value cannot be null. | 
| start | Int: the start of the line | 
| end | Int: the end of the line | 
| first | Boolean: true if this is the first line of its paragraph | 
| layout | Layout: This value cannot be null. | 
getColor
open fun getColor(): Int
Get the color of the quote stripe.
| Return | |
|---|---|
| Int | the color of the quote stripe. | 
getGapWidth
open fun getGapWidth(): Int
Get the width of the gap between the stripe and the text.
| Return | |
|---|---|
| Int | the width of the gap between the stripe and the text. | 
getLeadingMargin
open fun getLeadingMargin(first: Boolean): Int
| Parameters | |
|---|---|
| first | Boolean: true if the request is for the first line of a paragraph, false for subsequent lines | 
| Return | |
|---|---|
| Int | the offset for the margin. | 
getStripeWidth
open fun getStripeWidth(): Int
Get the width of the quote stripe.
| Return | |
|---|---|
| Int | the width of the quote stripe. | 
toString
open fun toString(): String
| Return | |
|---|---|
| String | a string representation of the object. | 
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
| Parameters | |
|---|---|
| dest | Parcel: The Parcel in which the object should be written. This value cannot be null. | 
| flags | Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either0or a combination ofandroid.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES | 
