# LeadingMarginSpan.LeadingMarginSpan2

Added in[API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/text/style/LeadingMarginSpan.LeadingMarginSpan2#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/text/style/LeadingMarginSpan.LeadingMarginSpan2#inhmethods)  

# LeadingMarginSpan.LeadingMarginSpan2

*** ** * ** ***

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

`
public
static


interface
LeadingMarginSpan.LeadingMarginSpan2
`  
`


implements

`[LeadingMarginSpan](https://developer.android.com/reference/android/text/style/LeadingMarginSpan)`,

`[WrapTogetherSpan](https://developer.android.com/reference/android/text/style/WrapTogetherSpan)`


`

|---------------------------------------------------------|
| android.text.style.LeadingMarginSpan.LeadingMarginSpan2 |

<br />

*** ** * ** ***

An extended version of[LeadingMarginSpan](https://developer.android.com/reference/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` | ` `[getLeadingMarginLineCount](https://developer.android.com/reference/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 methods |
|-----------------------|---|
| From interface` `[android.text.style.LeadingMarginSpan](https://developer.android.com/reference/android/text/style/LeadingMarginSpan)` ` |------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[drawLeadingMargin](https://developer.android.com/reference/android/text/style/LeadingMarginSpan#drawLeadingMargin(android.graphics.Canvas,%20android.graphics.Paint,%20int,%20int,%20int,%20int,%20int,%20java.lang.CharSequence,%20int,%20int,%20boolean,%20android.text.Layout))`(`[Canvas](https://developer.android.com/reference/android/graphics/Canvas)` c, `[Paint](https://developer.android.com/reference/android/graphics/Paint)` p, int x, int dir, int top, int baseline, int bottom, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, int start, int end, boolean first, `[Layout](https://developer.android.com/reference/android/text/Layout)` layout) ` Renders the leading margin. | | ` abstract int`  | ` `[getLeadingMargin](https://developer.android.com/reference/android/text/style/LeadingMarginSpan#getLeadingMargin(boolean))`(boolean first) ` Returns the amount by which to adjust the leading margin.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | ||

## Public methods

### getLeadingMarginLineCount

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

```
public abstract int getLeadingMarginLineCount ()
```

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

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |