Stay organized with collections
Save and categorize content based on your preferences.
class ExtraRenderingInfo
Class with information of a view useful to evaluate accessibility needs. Developers can refresh the node with the key EXTRA_DATA_RENDERING_INFO_KEY
to fetch the text size and unit if it is TextView
and the height and the width of layout params from ViewGroup
or TextView
.
Summary
Public methods
getLayoutSize
fun getLayoutSize(): Size?
Gets the size object containing the height and the width of android.view.ViewGroup.LayoutParams
if the node is a ViewGroup
or a TextView
, or null otherwise. Useful for some accessibility services to understand whether the text is scalable and fits the view or not.
getTextSizeInPx
fun getTextSizeInPx(): Float
Gets the text size if the node is a TextView
, or -1 otherwise. Useful for some accessibility services to understand whether the text is scalable and fits the view or not.
Return |
Float |
the text size of a TextView , or -1 otherwise. |
getTextSizeUnit
fun getTextSizeUnit(): Int
Gets the text size unit if the node is a TextView
, or -1 otherwise. Text size returned from getTextSizeInPx
in raw pixels may scale by factors and convert from other units. Useful for some accessibility services to understand whether the text is scalable and fits the view or not.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AccessibilityNodeInfo.ExtraRenderingInfo\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nExtraRenderingInfo\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/accessibility/AccessibilityNodeInfo.ExtraRenderingInfo \"View this page in Java\") \n\n```\nclass ExtraRenderingInfo\n```\n\n|---|--------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.view.accessibility.AccessibilityNodeInfo.ExtraRenderingInfo](#) |\n\nClass with information of a view useful to evaluate accessibility needs. Developers can refresh the node with the key [EXTRA_DATA_RENDERING_INFO_KEY](/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo#EXTRA_DATA_RENDERING_INFO_KEY:kotlin.String) to fetch the text size and unit if it is [TextView](../../widget/TextView.html#) and the height and the width of layout params from [ViewGroup](../ViewGroup.html#) or [TextView](../../widget/TextView.html#).\n\nSummary\n-------\n\n| Public methods ||\n|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Size](../../util/Size.html#)? | [getLayoutSize](#getLayoutSize())`()` Gets the size object containing the height and the width of [android.view.ViewGroup.LayoutParams](../ViewGroup.LayoutParams.html#) if the node is a [ViewGroup](../ViewGroup.html#) or a [TextView](../../widget/TextView.html#), or null otherwise. |\n| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | [getTextSizeInPx](#getTextSizeInPx())`()` Gets the text size if the node is a [TextView](../../widget/TextView.html#), or -1 otherwise. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getTextSizeUnit](#getTextSizeUnit())`()` Gets the text size unit if the node is a [TextView](../../widget/TextView.html#), or -1 otherwise. |\n\nPublic methods\n--------------\n\n### getLayoutSize\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getLayoutSize(): Size?\n```\n\nGets the size object containing the height and the width of [android.view.ViewGroup.LayoutParams](../ViewGroup.LayoutParams.html#) if the node is a [ViewGroup](../ViewGroup.html#) or a [TextView](../../widget/TextView.html#), or null otherwise. Useful for some accessibility services to understand whether the text is scalable and fits the view or not.\n\n| Return ||\n|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Size](../../util/Size.html#)? | a [Size](../../util/Size.html#) stores layout height and layout width of the view, or null otherwise. And the size value may be in pixels, [android.view.ViewGroup.LayoutParams#MATCH_PARENT](../ViewGroup.LayoutParams.html#MATCH_PARENT:kotlin.Int), or [android.view.ViewGroup.LayoutParams#WRAP_CONTENT](../ViewGroup.LayoutParams.html#WRAP_CONTENT:kotlin.Int) |\n\n### getTextSizeInPx\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getTextSizeInPx(): Float\n```\n\nGets the text size if the node is a [TextView](../../widget/TextView.html#), or -1 otherwise. Useful for some accessibility services to understand whether the text is scalable and fits the view or not.\n\n| Return ||\n|--------------------------------------------------------------------------------|-------------------------------------------------|\n| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | the text size of a `TextView`, or -1 otherwise. |\n\n### getTextSizeUnit\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getTextSizeUnit(): Int\n```\n\nGets the text size unit if the node is a [TextView](../../widget/TextView.html#), or -1 otherwise. Text size returned from [getTextSizeInPx](#getTextSizeInPx()) in raw pixels may scale by factors and convert from other units. Useful for some accessibility services to understand whether the text is scalable and fits the view or not.\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the text size unit which type is [TypedValue.TYPE_DIMENSION](../../util/TypedValue.html#TYPE_DIMENSION:kotlin.Int) of a `TextView`, or -1 otherwise. |\n\n**See Also**\n\n- [android.util.TypedValue#TYPE_DIMENSION](../../util/TypedValue.html#TYPE_DIMENSION:kotlin.Int)"]]