LeadingMarginSpan
interface LeadingMarginSpan : ParagraphStyle
android.text.style.LeadingMarginSpan |
A paragraph style affecting the leading margin. There can be multiple leading margin spans on a single paragraph; they will be rendered in order, each adding its margin to the ones before it. The leading margin is on the right for lines in a right-to-left paragraph.
LeadingMarginSpans should be attached from the first character to the last character of a single paragraph.
Summary
Nested classes | |
---|---|
abstract |
An extended version of |
open |
The standard implementation of LeadingMarginSpan, which adjusts the margin but does not do any rendering. |
Public methods | |
---|---|
abstract 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. |
abstract Int |
getLeadingMargin(first: Boolean) Returns the amount by which to adjust the leading margin. |
Public methods
drawLeadingMargin
abstract 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!: the canvas |
p |
Paint!: the paint. The this should be left unchanged on exit. |
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!: the text |
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!: the layout containing this line |
getLeadingMargin
abstract fun getLeadingMargin(first: Boolean): Int
Returns the amount by which to adjust the leading margin. Positive values move away from the leading edge of the paragraph, negative values move towards it.
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. |