ViewStructure
public
abstract
class
ViewStructure
extends Object
| java.lang.Object | |
| ↳ | android.view.ViewStructure |
Container for storing additional per-view data generated by View.onProvideStructure and View.onProvideAutofillStructure.
Summary
Nested classes | |
|---|---|
class |
ViewStructure.HtmlInfo
Simplified representation of the HTML properties of a node that represents an HTML element. |
Public constructors | |
|---|---|
ViewStructure()
|
|
Public methods | |
|---|---|
abstract
int
|
addChildCount(int num)
Add to this view's child count. |
abstract
void
|
asyncCommit()
Call when done populating a |
abstract
ViewStructure
|
asyncNewChild(int index)
Like |
abstract
AutofillId
|
getAutofillId()
Gets the |
abstract
int
|
getChildCount()
Return the child count as set by |
abstract
Bundle
|
getExtras()
Get extra data associated with this view structure; the returned Bundle is mutable, allowing you to view and modify its contents. |
abstract
CharSequence
|
getHint()
Retrieve the last hint set by |
abstract
CharSequence
|
getText()
Retrieve the last |
abstract
int
|
getTextSelectionEnd()
Retrieve the last selection end set by |
abstract
int
|
getTextSelectionStart()
Retrieve the last selection start set by |
abstract
boolean
|
hasExtras()
Returns true if |
abstract
ViewStructure
|
newChild(int index)
Create a new child |
abstract
ViewStructure.HtmlInfo.Builder
|
newHtmlInfoBuilder(String tagName)
Creates a new |
abstract
void
|
setAccessibilityFocused(boolean state)
Set the accessibility focused state of this view, as per
|
abstract
void
|
setActivated(boolean state)
Set the activated state of this view, as per |
abstract
void
|
setAlpha(float alpha)
Set an alpha transformation that is applied to this view, as per
|
abstract
void
|
setAutofillHints(String[] hint)
Sets the a hints that helps the autofill service to select the appropriate data to fill the view. |
abstract
void
|
setAutofillId(AutofillId id)
Sets the |
abstract
void
|
setAutofillId(AutofillId parentId, int virtualId)
Sets the |
abstract
void
|
setAutofillOptions(CharSequence[] options)
Sets the options that can be used to autofill this node. |
abstract
void
|
setAutofillType(int type)
Sets the |
abstract
void
|
setAutofillValue(AutofillValue value)
Sets the |
abstract
void
|
setCheckable(boolean state)
Set the checkable state of this view, such as whether it implements the
|
abstract
void
|
setChecked(boolean state)
Set the checked state of this view, such as
|
abstract
void
|
setChildCount(int num)
Set the number of children of this view, which defines the range of indices you can
use with |
abstract
void
|
setClassName(String className)
Set the class name of the view, as per
|
abstract
void
|
setClickable(boolean state)
Set the clickable state of this view, as per |
abstract
void
|
setContentDescription(CharSequence contentDescription)
Set the content description of the view, as per
|
abstract
void
|
setContextClickable(boolean state)
Set the context clickable state of this view, as per
|
abstract
void
|
setDataIsSensitive(boolean sensitive)
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
void
|
setDimens(int left, int top, int scrollX, int scrollY, int width, int height)
Set the basic dimensions of this view. |
abstract
void
|
setElevation(float elevation)
Set the visual elevation (shadow) of the view, as per
|
abstract
void
|
setEnabled(boolean state)
Set the enabled state of this view, as per |
abstract
void
|
setFocusable(boolean state)
Set the focusable state of this view, as per |
abstract
void
|
setFocused(boolean state)
Set the focused state of this view, as per |
abstract
void
|
setHint(CharSequence hint)
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. |
abstract
void
|
setHtmlInfo(ViewStructure.HtmlInfo htmlInfo)
Sets the HTML properties of this node when it represents an HTML element. |
abstract
void
|
setId(int id, String packageName, String typeName, String entryName)
Set the identifier for this view. |
abstract
void
|
setInputType(int inputType)
Sets the |
abstract
void
|
setLocaleList(LocaleList localeList)
Sets the the list of locales associated with this node. |
abstract
void
|
setLongClickable(boolean state)
Set the long clickable state of this view, as per
|
abstract
void
|
setOpaque(boolean opaque)
Set the opaque state of this view, as per |
abstract
void
|
setSelected(boolean state)
Set the selected state of this view, as per |
abstract
void
|
setText(CharSequence text)
Set the text that is associated with this view. |
abstract
void
|
setText(CharSequence text, int selectionStart, int selectionEnd)
Like |
abstract
void
|
setTextLines(int[] charOffsets, int[] baselines)
Set line information for test that was previously supplied through
|
abstract
void
|
setTextStyle(float size, int fgColor, int bgColor, int style)
Explicitly set default global style information for text that was previously set with
|
abstract
void
|
setTransformation(Matrix matrix)
Set the transformation matrix associated with this view, as per
|
abstract
void
|
setVisibility(int visibility)
Set the visibility state of this view, as per
|
abstract
void
|
setWebDomain(String domain)
Sets the Web domain represented by this node. |
Inherited methods | |
|---|---|
java.lang.Object
| |
Public constructors
Public methods
addChildCount
int addChildCount (int num)
Add to this view's child count. This increases the current child count by
num children beyond what was last set by setChildCount(int)
or addChildCount(int). The index at which the new child starts in the child
array is returned.
| Parameters | |
|---|---|
num |
int: The number of new children to add. |
| Returns | |
|---|---|
int |
Returns the index in the child array at which the new children start. |
asyncCommit
void asyncCommit ()
Call when done populating a ViewStructure returned by
asyncNewChild(int).
asyncNewChild
ViewStructure asyncNewChild (int index)
Like newChild(int), 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.
| Parameters | |
|---|---|
index |
int |
| Returns | |
|---|---|
ViewStructure |
Returns an fresh ViewStructure ready to be filled in.
|
getAutofillId
AutofillId getAutofillId ()
Gets the AutofillId associated with this node.
| Returns | |
|---|---|
AutofillId |
This value may be |
getChildCount
int getChildCount ()
Return the child count as set by setChildCount(int).
| Returns | |
|---|---|
int |
|
getExtras
Bundle getExtras ()
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.
| Returns | |
|---|---|
Bundle |
|
getHint
CharSequence getHint ()
Retrieve the last hint set by setHint(CharSequence).
| Returns | |
|---|---|
CharSequence |
|
getText
CharSequence getText ()
Retrieve the last setText(CharSequence).
| Returns | |
|---|---|
CharSequence |
|
getTextSelectionEnd
int getTextSelectionEnd ()
Retrieve the last selection end set by setText(CharSequence, int, int).
| Returns | |
|---|---|
int |
|
getTextSelectionStart
int getTextSelectionStart ()
Retrieve the last selection start set by setText(CharSequence, int, int).
| Returns | |
|---|---|
int |
|
hasExtras
boolean hasExtras ()
Returns true if getExtras() has been used to create extra content.
| Returns | |
|---|---|
boolean |
|
newChild
ViewStructure newChild (int index)
Create a new child ViewStructure in this view, putting into the list of
children at index.
| Parameters | |
|---|---|
index |
int |
| Returns | |
|---|---|
ViewStructure |
Returns an fresh ViewStructure ready to be filled in.
|
newHtmlInfoBuilder
ViewStructure.HtmlInfo.Builder newHtmlInfoBuilder (String tagName)
Creates a new ViewStructure.HtmlInfo.Builder for the given HTML tag.
| Parameters | |
|---|---|
tagName |
String: name of the HTML tag.This value must never be |
| Returns | |
|---|---|
ViewStructure.HtmlInfo.Builder |
a new builder. |
setAccessibilityFocused
void setAccessibilityFocused (boolean state)
Set the accessibility focused state of this view, as per
View.isAccessibilityFocused().
| Parameters | |
|---|---|
state |
boolean |
setActivated
void setActivated (boolean state)
Set the activated state of this view, as per View.isActivated().
| Parameters | |
|---|---|
state |
boolean |
setAlpha
void setAlpha (float alpha)
Set an alpha transformation that is applied to this view, as per
View.getAlpha(). Value ranges from 0
(completely transparent) to 1 (completely opaque); the default is 1, which means
no transformation.
| Parameters | |
|---|---|
alpha |
float |
setAutofillHints
void setAutofillHints (String[] hint)
Sets the a hints that helps the autofill service to select the appropriate data to fill the view.
| Parameters | |
|---|---|
hint |
String This value may be |
setAutofillId
void setAutofillId (AutofillId id)
Sets the AutofillId associated with this node.
| Parameters | |
|---|---|
id |
AutofillId This value must never be |
setAutofillId
void setAutofillId (AutofillId parentId, int virtualId)
Sets the AutofillId for this virtual node.
| Parameters | |
|---|---|
parentId |
AutofillId: id of the parent node.This value must never be |
virtualId |
int: an opaque ID to the Android System; it's the same id used on
autofill(android.util.SparseArray).
|
setAutofillOptions
void setAutofillOptions (CharSequence[] options)
Sets the options that can be used to autofill this node.
Typically used by nodes whose getAutofillType() is a list to indicate the
meaning of each possible value in the list.
| Parameters | |
|---|---|
options |
CharSequence |
setAutofillType
void setAutofillType (int type)
Sets the getAutofillType() that can be used to autofill this node.
| Parameters | |
|---|---|
type |
int |
setAutofillValue
void setAutofillValue (AutofillValue value)
Sets the AutofillValue representing the current value of this node.
| Parameters | |
|---|---|
value |
AutofillValue |
setCheckable
void setCheckable (boolean state)
Set the checkable state of this view, such as whether it implements the
Checkable interface.
| Parameters | |
|---|---|
state |
boolean |
setChecked
void setChecked (boolean state)
Set the checked state of this view, such as
Checkable.isChecked().
| Parameters | |
|---|---|
state |
boolean |
setChildCount
void setChildCount (int num)
Set the number of children of this view, which defines the range of indices you can
use with newChild(int) and asyncNewChild(int). Calling this method again
resets all of the child state of the view, removing any children that had previously
been added.
| Parameters | |
|---|---|
num |
int |
setClassName
void setClassName (String className)
Set the class name of the view, as per
View.getAccessibilityClassName().
| Parameters | |
|---|---|
className |
String |
setClickable
void setClickable (boolean state)
Set the clickable state of this view, as per View.isClickable().
| Parameters | |
|---|---|
state |
boolean |
setContentDescription
void setContentDescription (CharSequence contentDescription)
Set the content description of the view, as per
View.getContentDescription().
| Parameters | |
|---|---|
contentDescription |
CharSequence |
setContextClickable
void setContextClickable (boolean state)
Set the context clickable state of this view, as per
View.isContextClickable().
| Parameters | |
|---|---|
state |
boolean |
setDataIsSensitive
void setDataIsSensitive (boolean sensitive)
Sets whether the data on this node is sensitive; if it is, then its content (text, autofill
value, etc..) is striped before calls to onFillRequest(android.service.autofill.FillRequest, android.os.CancellationSignal, android.service.autofill.FillCallback).
By default, all nodes are assumed to be sensitive, and only nodes that does not have PII (Personally Identifiable Information - sensitive data such as email addresses, credit card numbers, passwords, etc...) should be marked as non-sensitive; a good rule of thumb is to mark as non-sensitive nodes whose value were statically set from resources.
Notice that the content of even sensitive nodes are sent to the service (through the
onSaveRequest(android.service.autofill.SaveRequest, android.service.autofill.SaveCallback) call) when the user consented to save
thedata, so it is important to set the content of sensitive nodes as well, but mark them as
sensitive.
Should only be set when the node is used for autofill purposes - it will be ignored when used for Assist.
| Parameters | |
|---|---|
sensitive |
boolean |
setDimens
void setDimens (int left,
int top,
int scrollX,
int scrollY,
int width,
int height)
Set the basic dimensions of this view.
| Parameters | |
|---|---|
left |
int: The view's left position, in pixels relative to its parent's left edge. |
top |
int: The view's top position, in pixels relative to its parent's top edge. |
scrollX |
int: How much the view's x coordinate space has been scrolled, in pixels. |
scrollY |
int: How much the view's y coordinate space has been scrolled, in pixels. |
width |
int: The view's visible width, in pixels. This is the width visible on screen,
not the total data width of a scrollable view. |
height |
int: The view's visible height, in pixels. This is the height visible on
screen, not the total data height of a scrollable view.
|
setElevation
void setElevation (float elevation)
Set the visual elevation (shadow) of the view, as per
View.getZ(). Note this is not related
to the physical Z-ordering of this view relative to its other siblings (that is how
they overlap when drawing), it is only the visual representation for shadowing.
| Parameters | |
|---|---|
elevation |
float |
setEnabled
void setEnabled (boolean state)
Set the enabled state of this view, as per View.isEnabled().
| Parameters | |
|---|---|
state |
boolean |
setFocusable
void setFocusable (boolean state)
Set the focusable state of this view, as per View.isFocusable().
| Parameters | |
|---|---|
state |
boolean |
setFocused
void setFocused (boolean state)
Set the focused state of this view, as per View.isFocused().
| Parameters | |
|---|---|
state |
boolean |
setHint
void setHint (CharSequence hint)
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.
| Parameters | |
|---|---|
hint |
CharSequence |
setHtmlInfo
void setHtmlInfo (ViewStructure.HtmlInfo htmlInfo)
Sets the HTML properties of this node when it represents an HTML element.
Should only be set when the node is used for autofill purposes - it will be ignored when used for assist.
| Parameters | |
|---|---|
htmlInfo |
ViewStructure.HtmlInfo: HTML properties.
This value must never be |
setId
void setId (int id,
String packageName,
String typeName,
String entryName)
Set the identifier for this view.
| Parameters | |
|---|---|
id |
int: The view's identifier, as per View.getId(). |
packageName |
String: The package name of the view's identifier, or null if there is none. |
typeName |
String: The type name of the view's identifier, or null if there is none. |
entryName |
String: The entry name of the view's identifier, or null if there is none.
|
setInputType
void setInputType (int inputType)
Sets the InputType bits of this node.
| Parameters | |
|---|---|
inputType |
int: inputType bits as defined by InputType.
|
setLocaleList
void setLocaleList (LocaleList localeList)
Sets the the list of locales associated with this node.
| Parameters | |
|---|---|
localeList |
LocaleList |
setLongClickable
void setLongClickable (boolean state)
Set the long clickable state of this view, as per
View.isLongClickable().
| Parameters | |
|---|---|
state |
boolean |
setOpaque
void setOpaque (boolean opaque)
Set the opaque state of this view, as per View.isOpaque().
| Parameters | |
|---|---|
opaque |
boolean |
setSelected
void setSelected (boolean state)
Set the selected state of this view, as per View.isSelected().
| Parameters | |
|---|---|
state |
boolean |
setText
void setText (CharSequence text)
Set the text that is associated with this view. There is no selection associated with the text. The text may have style spans to supply additional display and semantic information.
| Parameters | |
|---|---|
text |
CharSequence |
setText
void setText (CharSequence text, int selectionStart, int selectionEnd)
Like setText(CharSequence) but with an active selection
extending from selectionStart through selectionEnd.
| Parameters | |
|---|---|
text |
CharSequence |
selectionStart |
int |
selectionEnd |
int |
setTextLines
void setTextLines (int[] charOffsets,
int[] baselines)
Set line information for test that was previously supplied through
setText(CharSequence). This provides the line breaking of the text as it
is shown on screen. This function takes ownership of the provided arrays; you should
not make further modification to them.
| Parameters | |
|---|---|
charOffsets |
int: The offset in to setText(CharSequence) where a line starts. |
baselines |
int: The baseline where the line is drawn on screen.
|
setTextStyle
void setTextStyle (float size,
int fgColor,
int bgColor,
int style)
Explicitly set default global style information for text that was previously set with
setText(CharSequence).
| Parameters | |
|---|---|
size |
float: The size, in pixels, of the text. |
fgColor |
int: The foreground color, packed as 0xAARRGGBB. |
bgColor |
int: The background color, packed as 0xAARRGGBB. |
style |
int: Style flags, as defined by AssistStructure.ViewNode.
|
setTransformation
void setTransformation (Matrix matrix)
Set the transformation matrix associated with this view, as per
View.getMatrix(), or null if there is none.
| Parameters | |
|---|---|
matrix |
Matrix |
setVisibility
void setVisibility (int visibility)
Set the visibility state of this view, as per
View.getVisibility().
| Parameters | |
|---|---|
visibility |
int |
setWebDomain
void setWebDomain (String domain)
Sets the Web domain represented by this node.
Typically used when the view is a container for an HTML document.
| Parameters | |
|---|---|
domain |
String: URL representing the domain; only the host part will be used.
This value may be |
Annotations
Interfaces
- ActionMode.Callback
- ActionProvider.VisibilityListener
- Choreographer.FrameCallback
- CollapsibleActionView
- ContextMenu
- ContextMenu.ContextMenuInfo
- GestureDetector.OnContextClickListener
- GestureDetector.OnDoubleTapListener
- GestureDetector.OnGestureListener
- InputQueue.Callback
- KeyEvent.Callback
- LayoutInflater.Factory
- LayoutInflater.Factory2
- LayoutInflater.Filter
- Menu
- MenuItem
- MenuItem.OnActionExpandListener
- MenuItem.OnMenuItemClickListener
- PixelCopy.OnPixelCopyFinishedListener
- ScaleGestureDetector.OnScaleGestureListener
- SubMenu
- SurfaceHolder
- SurfaceHolder.Callback
- SurfaceHolder.Callback2
- TextureView.SurfaceTextureListener
- View.OnApplyWindowInsetsListener
- View.OnAttachStateChangeListener
- View.OnCapturedPointerListener
- View.OnClickListener
- View.OnContextClickListener
- View.OnCreateContextMenuListener
- View.OnDragListener
- View.OnFocusChangeListener
- View.OnGenericMotionListener
- View.OnHoverListener
- View.OnKeyListener
- View.OnLayoutChangeListener
- View.OnLongClickListener
- View.OnScrollChangeListener
- View.OnSystemUiVisibilityChangeListener
- View.OnTouchListener
- ViewGroup.OnHierarchyChangeListener
- ViewManager
- ViewParent
- ViewStub.OnInflateListener
- ViewTreeObserver.OnDrawListener
- ViewTreeObserver.OnGlobalFocusChangeListener
- ViewTreeObserver.OnGlobalLayoutListener
- ViewTreeObserver.OnPreDrawListener
- ViewTreeObserver.OnScrollChangedListener
- ViewTreeObserver.OnTouchModeChangeListener
- ViewTreeObserver.OnWindowAttachListener
- ViewTreeObserver.OnWindowFocusChangeListener
- Window.Callback
- Window.OnFrameMetricsAvailableListener
- Window.OnRestrictedCaptionAreaChangedListener
- WindowManager
Classes
- AbsSavedState
- ActionMode
- ActionMode.Callback2
- ActionProvider
- Choreographer
- ContextThemeWrapper
- Display
- Display.HdrCapabilities
- Display.Mode
- DragAndDropPermissions
- DragEvent
- FocusFinder
- FrameMetrics
- FrameStats
- GestureDetector
- GestureDetector.SimpleOnGestureListener
- Gravity
- HapticFeedbackConstants
- InputDevice
- InputDevice.MotionRange
- InputEvent
- InputQueue
- KeyboardShortcutGroup
- KeyboardShortcutInfo
- KeyCharacterMap
- KeyCharacterMap.KeyData
- KeyEvent
- KeyEvent.DispatcherState
- LayoutInflater
- MenuInflater
- MotionEvent
- MotionEvent.PointerCoords
- MotionEvent.PointerProperties
- OrientationEventListener
- OrientationListener
- PixelCopy
- PointerIcon
- ScaleGestureDetector
- ScaleGestureDetector.SimpleOnScaleGestureListener
- SearchEvent
- SoundEffectConstants
- Surface
- SurfaceView
- TextureView
- TouchDelegate
- VelocityTracker
- View
- View.AccessibilityDelegate
- View.BaseSavedState
- View.DragShadowBuilder
- View.MeasureSpec
- ViewAnimationUtils
- ViewConfiguration
- ViewDebug
- ViewGroup
- ViewGroup.LayoutParams
- ViewGroup.MarginLayoutParams
- ViewGroupOverlay
- ViewOutlineProvider
- ViewOverlay
- ViewPropertyAnimator
- ViewStructure
- ViewStructure.HtmlInfo
- ViewStructure.HtmlInfo.Builder
- ViewStub
- ViewTreeObserver
- Window
- WindowAnimationFrameStats
- WindowContentFrameStats
- WindowId
- WindowId.FocusObserver
- WindowInsets
- WindowManager.LayoutParams
Enums
Exceptions


