ViewStructureCompat
public class ViewStructureCompat
Helper for accessing features in ViewStructure.
Currently this helper class only has features for content capture usage. Other features for Autofill are not available.
Summary
Public methods |
|
|---|---|
void |
setClassName(@NonNull String string)Set the class name of the view, as per |
void |
setContentDescription(@NonNull CharSequence charSequence)Set the content description of the view, as per |
void |
setDimens(Set the basic dimensions of this view. |
void |
setText(@NonNull CharSequence charSequence)Set the text that is associated with this view. |
@NonNull ViewStructure |
@RequiresApi(value = 23)Provides the |
static @NonNull ViewStructureCompat |
@RequiresApi(value = 23)Provides a backward-compatible wrapper for |
Public methods
setClassName
public void setClassName(@NonNull String string)
Set the class name of the view, as per View.getAccessibilityClassName(). Compatibility behavior:
- SDK 23 and above, this method matches platform behavior.
- SDK 22 and below, this method does nothing.
setContentDescription
public void setContentDescription(@NonNull CharSequence charSequence)
Set the content description of the view, as per View.getContentDescription(). Compatibility behavior:
- SDK 23 and above, this method matches platform behavior.
- SDK 22 and below, this method does nothing.
setDimens
public void setDimens(
int left,
int top,
int scrollX,
int scrollY,
int width,
int height
)
Set the basic dimensions of this view.
| Parameters | |
|---|---|
int left |
The view's left position, in pixels relative to its parent's left edge. |
int top |
The view's top position, in pixels relative to its parent's top edge. |
int scrollX |
How much the view's x coordinate space has been scrolled, in pixels. |
int scrollY |
How much the view's y coordinate space has been scrolled, in pixels. |
int width |
The view's visible width, in pixels. This is the width visible on screen, not the total data width of a scrollable view. |
int height |
The view's visible height, in pixels. This is the height visible on screen, not the total data height of a scrollable view. Compatibility behavior:
|
setText
public void setText(@NonNull CharSequence charSequence)
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. Compatibility behavior:
- SDK 23 and above, this method matches platform behavior.
- SDK 22 and below, this method does nothing.
toViewStructure
@RequiresApi(value = 23)
public @NonNull ViewStructure toViewStructure()
Provides the ViewStructure represented by this object.
This method is not supported on devices running SDK <23 since the platform class will not be available.
| Returns | |
|---|---|
@NonNull ViewStructure |
platform class object |
| See also | |
|---|---|
toViewStructureCompat |
toViewStructureCompat
@RequiresApi(value = 23)
public static @NonNull ViewStructureCompat toViewStructureCompat(@NonNull ViewStructure contentCaptureSession)
Provides a backward-compatible wrapper for ViewStructure.
This method is not supported on devices running SDK <23 since the platform class will not be available.
| Parameters | |
|---|---|
@NonNull ViewStructure contentCaptureSession |
platform class to wrap |
| Returns | |
|---|---|
@NonNull ViewStructureCompat |
wrapped class |