Added in API level 30

ExtraRenderingInfo


class ExtraRenderingInfo
kotlin.Any
   ↳ android.view.accessibility.AccessibilityNodeInfo.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
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.

Float

Gets the text size if the node is a TextView, or -1 otherwise.

Int

Gets the text size unit if the node is a TextView, or -1 otherwise.

Public methods

getLayoutSize

Added in API level 30
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.

Return
Size? a Size 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, or android.view.ViewGroup.LayoutParams#WRAP_CONTENT

getTextSizeInPx

Added in API level 30
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

Added in API level 30
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.

Return
Int the text size unit which type is TypedValue#TYPE_DIMENSION of a TextView, or -1 otherwise.