# LeadingMarginSpan.LeadingMarginSpan2

Added in[API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# LeadingMarginSpan2

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/text/style/LeadingMarginSpan.LeadingMarginSpan2 "View this page in Java")  

```
interface LeadingMarginSpan2 : LeadingMarginSpan, WrapTogetherSpan
```

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.text.style.LeadingMarginSpan.LeadingMarginSpan2](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan.LeadingMarginSpan2#) |

An extended version of[LeadingMarginSpan](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan), which allows the implementor to specify the number of lines of the paragraph to which this object is attached that the "first line of paragraph" margin width will be applied to.

There should only be one LeadingMarginSpan2 per paragraph. The leading margin line count affects all LeadingMarginSpans in the paragraph, adjusting the number of lines to which the first line margin is applied.

As with LeadingMarginSpans, LeadingMarginSpan2s should be attached from the beginning to the end of a paragraph.

## Summary

|                                                                                                                                                                                  Public methods                                                                                                                                                                                   ||
|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getLeadingMarginLineCount](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan.LeadingMarginSpan2#getLeadingMarginLineCount())`()` Returns the number of lines of the paragraph to which this object is attached that the "first line" margin will apply to. |

| Inherited functions ||
|---|---|
| From class[LeadingMarginSpan](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan) |------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [drawLeadingMargin](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan#drawLeadingMargin(android.graphics.Canvas,%20android.graphics.Paint,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.CharSequence,%20kotlin.Int,%20kotlin.Int,%20kotlin.Boolean,%20android.text.Layout))`(`c:` `[Canvas](https://developer.android.com/reference/kotlin/android/graphics/Canvas.html#)!`, `p:` `[Paint](https://developer.android.com/reference/kotlin/android/graphics/Paint.html#)!`, `x:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `dir:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `top:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `baseline:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `bottom:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `text:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`, `start:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `end:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `first:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `layout:` `[Layout](https://developer.android.com/reference/kotlin/android/text/Layout.html#)!`)` <br /> Renders the leading margin. This is called before the margin has been adjusted by the value returned by[getLeadingMargin(boolean)](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan#getLeadingMargin(kotlin.Boolean)). <br /> | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)   | [getLeadingMargin](https://developer.android.com/reference/kotlin/android/text/style/LeadingMarginSpan#getLeadingMargin(kotlin.Boolean))`(`first:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> 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. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | ||

## Public methods

### getLeadingMarginLineCount

Added in[API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun getLeadingMarginLineCount(): Int
```

Returns the number of lines of the paragraph to which this object is attached that the "first line" margin will apply to.