Added in API level 23

ViewStructure


abstract class ViewStructure
kotlin.Any
   ↳ android.view.ViewStructure

ViewStructure is a container for storing additional per-view data generated by View.onProvideStructure and View.onProvideAutofillStructure.

To learn more about using Autofill in your app, read the Autofill Framework guides.

Summary

Nested classes
abstract

Simplified representation of the HTML properties of a node that represents an HTML element.

Constants
static String

Key used for writing the type of the view that generated the virtual structure of its children.

static String

Key used for specifying the version of the view that generated the virtual structure for itself and its children

Public constructors

Public methods
abstract Int

Add to this view's child count.

abstract Unit

Call when done populating a ViewStructure returned by asyncNewChild.

abstract ViewStructure!

Like newChild, but allows the caller to asynchronously populate the returned child.

open Unit

Clears the credential request previously set through ViewStructure.setPendingCredentialRequest(GetCredentialRequest,OutcomeReceiver)

abstract AutofillId?

Gets the AutofillId associated with this node.

abstract Int

Return the child count as set by setChildCount.

abstract Bundle!

Get extra data associated with this view structure; the returned Bundle is mutable, allowing you to view and modify its contents.

abstract CharSequence!

Retrieve the last hint set by setHint.

open OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>?

Gets the callback associated with this node.

open GetCredentialRequest?

Gets the GetCredentialRequest associated with this node.

abstract CharSequence!

Retrieve the last setText(CharSequence).

abstract Int

Retrieve the last selection end set by setText(CharSequence,int,int).

abstract Int

Retrieve the last selection start set by setText(CharSequence,int,int).

abstract Boolean

Returns true if getExtras has been used to create extra content.

abstract ViewStructure!
newChild(index: Int)

Create a new child ViewStructure in this view, putting into the list of children at index.

abstract ViewStructure.HtmlInfo.Builder!

Creates a new HtmlInfo.Builder for the given HTML tag.

abstract Unit

Set the accessibility focused state of this view, as per View.isAccessibilityFocused().

abstract Unit

Set the activated state of this view, as per View.isActivated().

abstract Unit
setAlpha(alpha: Float)

Set an alpha transformation that is applied to this view, as per View.getAlpha().

abstract Unit

Sets the a hints that helps the autofill service to select the appropriate data to fill the view.

abstract Unit

Sets the AutofillId associated with this node.

abstract Unit
setAutofillId(parentId: AutofillId, virtualId: Int)

Sets the AutofillId for this virtual node.

abstract Unit

Sets the options that can be used to autofill this node.

abstract Unit

Sets the View.getAutofillType() that can be used to autofill this node.

abstract Unit

Sets the AutofillValue representing the current value of this node.

abstract Unit

Set the checkable state of this view, such as whether it implements the android.widget.Checkable interface.

abstract Unit

Set the checked state of this view, such as Checkable.isChecked().

abstract Unit

Set the number of children of this view, which defines the range of indices you can use with newChild and asyncNewChild.

abstract Unit
setClassName(className: String!)

Set the class name of the view, as per View.getAccessibilityClassName().

abstract Unit

Set the clickable state of this view, as per View.isClickable().

abstract Unit
setContentDescription(contentDescription: CharSequence!)

Set the content description of the view, as per View.getContentDescription().

abstract Unit

Set the context clickable state of this view, as per View.isContextClickable().

abstract Unit

Sets whether the data on this node is sensitive; if it is, then its content (text, autofill value, etc..) is striped before calls to

abstract Unit
setDimens(left: Int, top: Int, scrollX: Int, scrollY: Int, width: Int, height: Int)

Set the basic dimensions of this view.

abstract Unit
setElevation(elevation: Float)

Set the visual elevation (shadow) of the view, as per View.getZ().

abstract Unit

Set the enabled state of this view, as per View.isEnabled().

abstract Unit

Set the focusable state of this view, as per View.isFocusable().

abstract Unit

Set the focused state of this view, as per View.isFocused().

abstract Unit

Set optional hint text associated with this view; this is for example the text that is shown by an EditText when it is empty to indicate to the user the kind of text to input.

open Unit
setHintIdEntry(entryName: String)

Sets the identifier used to set the hint associated with this view.

abstract Unit

Sets the HTML properties of this node when it represents an HTML element.

abstract Unit
setId(id: Int, packageName: String!, typeName: String!, entryName: String!)

Set the identifier for this view.

open Unit

Sets the importantForAutofill mode of the view associated with this node.

abstract Unit
setInputType(inputType: Int)

Sets the android.text.InputType bits of this node.

abstract Unit
setLocaleList(localeList: LocaleList!)

Sets the the list of locales associated with this node.

abstract Unit

Set the long clickable state of this view, as per View.isLongClickable().

open Unit
setMaxTextEms(maxEms: Int)

Sets the maximum width in ems of the text associated with this view, when supported.

open Unit
setMaxTextLength(maxLength: Int)

Sets the maximum length of the text associated with this view, when supported.

open Unit
setMinTextEms(minEms: Int)

Sets the minimum width in ems of the text associated with this view, when supported.

abstract Unit
setOpaque(opaque: Boolean)

Set the opaque state of this view, as per View.isOpaque().

open Unit

Sets a credential request to be fired to android.credentials.CredentialManager when this node is focused

open Unit

Sets the MIME types accepted by this view.

abstract Unit

Set the selected state of this view, as per View.isSelected().

abstract Unit

Set the text that is associated with this view.

abstract Unit
setText(text: CharSequence!, selectionStart: Int, selectionEnd: Int)

Like setText(CharSequence) but with an active selection extending from selectionStart through selectionEnd.

open Unit
setTextIdEntry(entryName: String)

Sets the identifier used to set the text associated with this view.

abstract Unit
setTextLines(charOffsets: IntArray!, baselines: IntArray!)

Set line information for test that was previously supplied through setText(CharSequence).

abstract Unit
setTextStyle(size: Float, fgColor: Int, bgColor: Int, style: Int)

Explicitly set default global style information for text that was previously set with #setText.

abstract Unit

Set the transformation matrix associated with this view, as per View.getMatrix(), or null if there is none.

abstract Unit
setVisibility(visibility: Int)

Set the visibility state of this view, as per View.getVisibility().

abstract Unit
setWebDomain(domain: String?)

Sets the Web domain represented by this node.

Constants

EXTRA_VIRTUAL_STRUCTURE_TYPE

Added in API level 36
static val EXTRA_VIRTUAL_STRUCTURE_TYPE: String

Key used for writing the type of the view that generated the virtual structure of its children.

For example, if the virtual structure is generated by a webview, the value would be "WebView". If the virtual structure is generated by a compose view, then the value would be "ComposeView". The value is of type String.

This value is added to mainly help with debugging purpose.

Value: "android.view.extra.VIRTUAL_STRUCTURE_TYPE"

EXTRA_VIRTUAL_STRUCTURE_VERSION_NUMBER

Added in API level 36
static val EXTRA_VIRTUAL_STRUCTURE_VERSION_NUMBER: String

Key used for specifying the version of the view that generated the virtual structure for itself and its children

For example, if the virtual structure is generated by a webview of version "104.0.5112.69", then the value should be "104.0.5112.69"

Value: "android.view.extra.VIRTUAL_STRUCTURE_VERSION_NUMBER"

Public constructors

ViewStructure

ViewStructure()

Public methods

addChildCount

Added in API level 23
abstract fun addChildCount(num: Int): Int

Add to this view's child count. This increases the current child count by num children beyond what was last set by setChildCount or addChildCount. The index at which the new child starts in the child array is returned.

Parameters
num Int: The number of new children to add.
Return
Int Returns the index in the child array at which the new children start.

asyncCommit

Added in API level 23
abstract fun asyncCommit(): Unit

Call when done populating a ViewStructure returned by asyncNewChild.

asyncNewChild

Added in API level 23
abstract fun asyncNewChild(index: Int): ViewStructure!

Like newChild, but allows the caller to asynchronously populate the returned child. It can transfer the returned ViewStructure to another thread for it to build its content (and children etc). Once done, some thread must call asyncCommit to tell the containing ViewStructure that the async population is done.

NOTE: you must pre-allocate space for the child first, by calling either addChildCount(int) or setChildCount(int).

Return
ViewStructure! Returns an fresh ViewStructure ready to be filled in.

clearCredentialManagerRequest

Added in API level 35
open fun clearCredentialManagerRequest(): Unit

Clears the credential request previously set through ViewStructure.setPendingCredentialRequest(GetCredentialRequest,OutcomeReceiver)

getAutofillId

Added in API level 26
abstract fun getAutofillId(): AutofillId?

Gets the AutofillId associated with this node.

Return
AutofillId? This value may be null.

getChildCount

Added in API level 23
abstract fun getChildCount(): Int

Return the child count as set by setChildCount.

getExtras

Added in API level 23
abstract fun getExtras(): Bundle!

Get extra data associated with this view structure; the returned Bundle is mutable, allowing you to view and modify its contents. Keys placed in the Bundle should use an appropriate namespace prefix (such as com.google.MY_KEY) to avoid conflicts.

getHint

Added in API level 23
abstract fun getHint(): CharSequence!

Retrieve the last hint set by setHint.

getPendingCredentialCallback

Added in API level 35
open fun getPendingCredentialCallback(): OutcomeReceiver<GetCredentialResponse!, GetCredentialException!>?

Gets the callback associated with this node.

If null, no callback or request is associated with this node, and hence no android.credentials.CredentialManager request will be fired when this node is focused.

For details on how a request and callback can be set, see ViewStructure.setPendingCredentialRequest(GetCredentialRequest,OutcomeReceiver)

getPendingCredentialRequest

Added in API level 35
open fun getPendingCredentialRequest(): GetCredentialRequest?

Gets the GetCredentialRequest associated with this node.

If null, no request is associated with this node, and hence no android.credentials.CredentialManager request will be fired when this node is focused.

For details on how a request and callback can be set, see ViewStructure.setPendingCredentialRequest(GetCredentialRequest,OutcomeReceiver)

getText

Added in API level 23
abstract fun getText(): CharSequence!

Retrieve the last setText(CharSequence).

getTextSelectionEnd

Added in API level 23
abstract fun getTextSelectionEnd(): Int

Retrieve the last selection end set by setText(CharSequence,int,int).

getTextSelectionStart

Added in API level 23
abstract fun getTextSelectionStart(): Int

Retrieve the last selection start set by setText(CharSequence,int,int).