public abstract class ViewStructure
extends Object
| java.lang.Object | |
| android.view.ViewStructure | |
用于存储由 View.onProvideStructure生成的其他每个查看数据的 View.onProvideStructure 。
Public constructors |
|
|---|---|
ViewStructure() |
|
公共方法(Public methods) |
|
|---|---|
abstract int |
addChildCount(int num) 添加到此视图的孩子数量。 |
abstract void |
asyncCommit() |
abstract ViewStructure |
asyncNewChild(int index) 像 |
abstract int |
getChildCount() 按照 |
abstract Bundle |
getExtras() 获取与此视图结构关联的额外数据; 返回的Bundle是可变的,允许您查看和修改其内容。 |
abstract CharSequence |
getHint() 检索由 |
abstract CharSequence |
getText() 检索最后的 |
abstract int |
getTextSelectionEnd() 检索由 |
abstract int |
getTextSelectionStart() 检索由 |
abstract boolean |
hasExtras() 如果已使用 |
abstract ViewStructure |
newChild(int index) 在这个视图中创建一个新的儿童 |
abstract void |
setAccessibilityFocused(boolean state) 根据 |
abstract void |
setActivated(boolean state) 根据 |
abstract void |
setAlpha(float alpha) 根据 |
abstract void |
setCheckable(boolean state) 设置此视图的可检查状态,例如它是否实现了 |
abstract void |
setChecked(boolean state) 设置此视图的选中状态,如 |
abstract void |
setChildCount(int num) 设置此视图的子项数量,该数量定义了您可以使用的索引范围 |
abstract void |
setClassName(String className) 根据 |
abstract void |
setClickable(boolean state) 根据 |
abstract void |
setContentDescription(CharSequence contentDescription) 根据 |
abstract void |
setContextClickable(boolean state) 根据 |
abstract void |
setDimens(int left, int top, int scrollX, int scrollY, int width, int height) 设置此视图的基本尺寸。 |
abstract void |
setElevation(float elevation) 根据 |
abstract void |
setEnabled(boolean state) 根据 |
abstract void |
setFocusable(boolean state) 根据 |
abstract void |
setFocused(boolean state) 根据 |
abstract void |
setHint(CharSequence hint) 设置与此视图关联的可选提示文本; 这是例如EditText在空的时候显示的文本,以向用户指示要输入的文本类型。 |
abstract void |
setId(int id, String packageName, String typeName, String entryName) 为此视图设置标识符。 |
abstract void |
setLongClickable(boolean state) 按照 |
abstract void |
setSelected(boolean state) 根据 |
abstract void |
setText(CharSequence text) 设置与此视图关联的文本。 |
abstract void |
setText(CharSequence text, int selectionStart, int selectionEnd) 像 |
abstract void |
setTextLines(int[] charOffsets, int[] baselines) 设置以前通过 |
abstract void |
setTextStyle(float size, int fgColor, int bgColor, int style) 为以前使用 |
abstract void |
setTransformation(Matrix matrix) 根据 |
abstract void |
setVisibility(int visibility) 根据 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
int addChildCount (int num)
添加到此视图的孩子数量。 这增加了NUM孩子超出了上次设置当前儿童数setChildCount(int)或者addChildCount(int) 。 返回新子项在子数组中启动的索引。
| 参数(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. |
ViewStructure asyncNewChild (int index)
像newChild(int)一样,但允许调用者异步填充返回的子项。 它可以将返回的ViewStructure转移到另一个线程,以便构建其内容(以及子项等)。 一旦完成,一些线程必须调用asyncCommit()来告诉包含ViewStructure的异步总体完成。
| 参数(Parameters) | |
|---|---|
index |
int
|
| 返回(Returns) | |
|---|---|
ViewStructure |
Returns an fresh ViewStructure ready to be filled in. |
int getChildCount ()
按照 setChildCount(int)设置返回儿童人数。
| 返回(Returns) | |
|---|---|
int |
|
Bundle getExtras ()
获取与此视图结构关联的额外数据; 返回的Bundle是可变的,允许您查看和修改其内容。 放置在Bundle中的键应该使用适当的名称空间前缀(例如com.google.MY_KEY)以避免冲突。
| 返回(Returns) | |
|---|---|
Bundle |
|
CharSequence getHint ()
检索由 setHint(CharSequence)设置的最后提示。
| 返回(Returns) | |
|---|---|
CharSequence |
|
CharSequence getText ()
检索最后的 setText(CharSequence) 。
| 返回(Returns) | |
|---|---|
CharSequence |
|
int getTextSelectionEnd ()
检索由 setText(CharSequence, int, int)设置的最后选择结束。
| 返回(Returns) | |
|---|---|
int |
|
int getTextSelectionStart ()
检索由 setText(CharSequence, int, int)设置的最后一个选择开始。
| 返回(Returns) | |
|---|---|
int |
|
boolean hasExtras ()
如果已使用 getExtras()创建额外内容,则返回true。
| 返回(Returns) | |
|---|---|
boolean |
|
ViewStructure newChild (int index)
在这个视图中创建一个新的孩子 ViewStructure ,放入 索引处的儿童列表中。
| 参数(Parameters) | |
|---|---|
index |
int
|
| 返回(Returns) | |
|---|---|
ViewStructure |
Returns an fresh ViewStructure ready to be filled in. |
void setAccessibilityFocused (boolean state)
根据 View.isAccessibilityFocused() ,设置此视图的可访问性状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setActivated (boolean state)
根据 View.isActivated()设置此视图的激活状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setAlpha (float alpha)
根据View.getAlpha()设置应用于此视图的alpha变换。 取值范围从0(完全透明)到1(完全不透明); 默认值是1,这意味着没有转换。
| 参数(Parameters) | |
|---|---|
alpha |
float
|
void setCheckable (boolean state)
设置此视图的可检查状态,例如它是否实现了 Checkable界面。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setChecked (boolean state)
设置此视图的选中状态,例如 Checkable.isChecked() 。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setChildCount (int num)
设置此视图的子项数,它定义了您可以使用的索引范围newChild(int)和asyncNewChild(int) 。 再次调用此方法将重置视图的所有子状态,删除以前添加的任何子项。
| 参数(Parameters) | |
|---|---|
num |
int
|
void setClassName (String className)
根据 View.getAccessibilityClassName()设置视图的类名称。
| 参数(Parameters) | |
|---|---|
className |
String
|
void setClickable (boolean state)
根据 View.isClickable()设置此视图的可点击状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setContentDescription (CharSequence contentDescription)
根据 View.getContentDescription()设置视图的内容描述。
| 参数(Parameters) | |
|---|---|
contentDescription |
CharSequence
|
void setContextClickable (boolean state)
根据 View.isContextClickable()设置此视图的上下文可点击状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setDimens (int left,
int top,
int scrollX,
int scrollY,
int width,
int height)
设置此视图的基本尺寸。
| 参数(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. |
void setElevation (float elevation)
按照View.getZ()设置视图的视觉高程(阴影)。 请注意,这是不相关的这一观点相对于它的兄弟姐妹的物理Z排序(即它们如何重叠绘制时),它只是对阴影的视觉表现。
| 参数(Parameters) | |
|---|---|
elevation |
float
|
void setEnabled (boolean state)
根据 View.isEnabled()设置此视图的启用状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setFocusable (boolean state)
根据 View.isFocusable()设置此视图的可 View.isFocusable() 。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setFocused (boolean state)
根据 View.isFocused()设置此视图的重点状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setHint (CharSequence hint)
设置与此视图关联的可选提示文本; 这是例如EditText在空的时候显示的文本,以向用户指示要输入的文本类型。
| 参数(Parameters) | |
|---|---|
hint |
CharSequence
|
void setId (int id,
String packageName,
String typeName,
String entryName)
为此视图设置标识符。
| 参数(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. |
void setLongClickable (boolean state)
根据 View.isLongClickable()设置此视图的可长按可点击状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setSelected (boolean state)
根据 View.isSelected()设置此视图的选定状态。
| 参数(Parameters) | |
|---|---|
state |
boolean
|
void setText (CharSequence text)
设置与此视图关联的文本。 没有与文本相关的选择。 文本可以具有样式跨度以提供额外的显示和语义信息。
| 参数(Parameters) | |
|---|---|
text |
CharSequence
|
void setText (CharSequence text, int selectionStart, int selectionEnd)
像 setText(CharSequence)一样,但是具有从 selectionStart延伸到 selectionEnd的有效 选择 。
| 参数(Parameters) | |
|---|---|
text |
CharSequence
|
selectionStart |
int
|
selectionEnd |
int
|
void setTextLines (int[] charOffsets,
int[] baselines)
设置以前通过setText(CharSequence)提供的测试线路信息。 这提供了在屏幕上显示的文本的分行。 这个函数获得所提供的数组的所有权; 你不应该对它们做进一步的修改。
| 参数(Parameters) | |
|---|---|
charOffsets |
int: The offset in to setText(CharSequence) where a line starts. |
baselines |
int: The baseline where the line is drawn on screen. |
void setTextStyle (float size,
int fgColor,
int bgColor,
int style)
为以前使用 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. |
void setTransformation (Matrix matrix)
根据 View.getMatrix()设置与此视图关联的变换矩阵,如果没有则为null。
| 参数(Parameters) | |
|---|---|
matrix |
Matrix
|
void setVisibility (int visibility)
根据 View.getVisibility()设置此视图的可见性状态。
| 参数(Parameters) | |
|---|---|
visibility |
int
|