# MetricAffectingSpan

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

# MetricAffectingSpan

*** ** * ** ***

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

`
public


abstract
class
MetricAffectingSpan
`  
`


``

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


``


implements

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


`

|---|---|----------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle) ||
|   | ↳ | android.text.style.MetricAffectingSpan |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known direct subclasses [AbsoluteSizeSpan](https://developer.android.com/reference/android/text/style/AbsoluteSizeSpan),[LocaleSpan](https://developer.android.com/reference/android/text/style/LocaleSpan),[RelativeSizeSpan](https://developer.android.com/reference/android/text/style/RelativeSizeSpan),[ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan),[ScaleXSpan](https://developer.android.com/reference/android/text/style/ScaleXSpan),[StyleSpan](https://developer.android.com/reference/android/text/style/StyleSpan),[SubscriptSpan](https://developer.android.com/reference/android/text/style/SubscriptSpan),[SuperscriptSpan](https://developer.android.com/reference/android/text/style/SuperscriptSpan),[TextAppearanceSpan](https://developer.android.com/reference/android/text/style/TextAppearanceSpan),[TypefaceSpan](https://developer.android.com/reference/android/text/style/TypefaceSpan) |-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------| | [AbsoluteSizeSpan](https://developer.android.com/reference/android/text/style/AbsoluteSizeSpan)     | A span that changes the size of the text it's attached to.                                                                                      | | [LocaleSpan](https://developer.android.com/reference/android/text/style/LocaleSpan)                 | Changes the[Locale](https://developer.android.com/reference/java/util/Locale)of the text to which the span is attached.                         | | [RelativeSizeSpan](https://developer.android.com/reference/android/text/style/RelativeSizeSpan)     | Uniformly scales the size of the text to which it's attached by a certain proportion.                                                           | | [ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan)       |                                                                                                                                                 | | [ScaleXSpan](https://developer.android.com/reference/android/text/style/ScaleXSpan)                 | Scales horizontally the size of the text to which it's attached by a certain factor.                                                            | | [StyleSpan](https://developer.android.com/reference/android/text/style/StyleSpan)                   | Span that allows setting the style of the text it's attached to.                                                                                | | [SubscriptSpan](https://developer.android.com/reference/android/text/style/SubscriptSpan)           | The span that moves the position of the text baseline lower.                                                                                    | | [SuperscriptSpan](https://developer.android.com/reference/android/text/style/SuperscriptSpan)       | The span that moves the position of the text baseline higher.                                                                                   | | [TextAppearanceSpan](https://developer.android.com/reference/android/text/style/TextAppearanceSpan) | Sets the text appearance using the given[TextAppearance](https://developer.android.com/reference/android/R.styleable#TextAppearance)attributes. | | [TypefaceSpan](https://developer.android.com/reference/android/text/style/TypefaceSpan)             | Span that updates the typeface of the text it's attached to.                                                                                    | |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [DynamicDrawableSpan](https://developer.android.com/reference/android/text/style/DynamicDrawableSpan),[ImageSpan](https://developer.android.com/reference/android/text/style/ImageSpan) |-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [DynamicDrawableSpan](https://developer.android.com/reference/android/text/style/DynamicDrawableSpan) | Span that replaces the text it's attached to with a[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable)that can be aligned with the bottom or with the baseline of the surrounding text. | | [ImageSpan](https://developer.android.com/reference/android/text/style/ImageSpan)                     | Span that replaces the text it's attached to with a[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable)that can be aligned with the bottom or with the baseline of the surrounding text. | |

<br />

*** ** * ** ***

The classes that affect character-level text formatting in a way that changes the width or height of characters extend this class.

## Summary

|                                                        ### Public constructors                                                         ||
|-------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan#MetricAffectingSpan())`() ` |

|                                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                                            ||
|----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan) | ` `[getUnderlying](https://developer.android.com/reference/android/text/style/MetricAffectingSpan#getUnderlying())`() ` Returns "this" for most MetricAffectingSpans, but for MetricAffectingSpans that were generated by[CharacterStyle.wrap(CharacterStyle)](https://developer.android.com/reference/android/text/style/CharacterStyle#wrap(android.text.style.CharacterStyle)), returns the underlying MetricAffectingSpan. |
| ` abstract void`                                                                                         | ` `[updateMeasureState](https://developer.android.com/reference/android/text/style/MetricAffectingSpan#updateMeasureState(android.text.TextPaint))`(`[TextPaint](https://developer.android.com/reference/android/text/TextPaint)` textPaint) ` Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.                         |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle)` ` |-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle)        | ` `[getUnderlying](https://developer.android.com/reference/android/text/style/CharacterStyle#getUnderlying())`() ` Returns "this" for most CharacterStyles, but for CharacterStyles that were generated by[wrap(CharacterStyle)](https://developer.android.com/reference/android/text/style/CharacterStyle#wrap(android.text.style.CharacterStyle)), returns the underlying CharacterStyle. | | ` abstract void`                                                                                      | ` `[updateDrawState](https://developer.android.com/reference/android/text/style/CharacterStyle#updateDrawState(android.text.TextPaint))`(`[TextPaint](https://developer.android.com/reference/android/text/TextPaint)` tp) `                                                                                                                                                                | | ` static `[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle) | ` `[wrap](https://developer.android.com/reference/android/text/style/CharacterStyle#wrap(android.text.style.CharacterStyle))`(`[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle)` cs) ` A given CharacterStyle can only applied to a single region of a given Spanned.                                                                            | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### MetricAffectingSpan

```
public MetricAffectingSpan ()
```

<br />

<br />

## Public methods

### getUnderlying

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

```
public MetricAffectingSpan getUnderlying ()
```

Returns "this" for most MetricAffectingSpans, but for MetricAffectingSpans that were generated by[CharacterStyle.wrap(CharacterStyle)](https://developer.android.com/reference/android/text/style/CharacterStyle#wrap(android.text.style.CharacterStyle)), returns the underlying MetricAffectingSpan.

<br />

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| [MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan) | <br /> |

### updateMeasureState

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

```
public abstract void updateMeasureState (TextPaint textPaint)
```

Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.

<br />

|                                            Parameters                                            ||
|-------------|-------------------------------------------------------------------------------------|
| `textPaint` | `TextPaint`: the paint used for drawing the text This value cannot be`null`. <br /> |