简介
直接继承Button
- 支持textAllCaps回溯到的风格属性 Eclair MR1。
- 通过背景色调方法允许动态色调背景 ViewCompat。
- 允许使用backgroundTint和 设置背景色调backgroundTintMode。
使用
相对Button而言增加了水波纹特效
使用 android:textAllCaps 这个属性可以使英文自动转换大写
公共方法
onInitializeAccessibilityEvent (AccessibilityEvent event)
初始化AccessibilityEvent有关此视图的信息,该事件源是事件源。换句话说,可访问性事件的来源是其状态改变触发触发事件的视图。
示例:设置事件的密码属性以及超级实现设置的属性:
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setPassword(true);
}
onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)
使用关于此视图的信息初始化一个可访问性节点信息。基本实现集:
- setParent(View)
- setBoundsInParent(Rect)
- setBoundsInScreen(Rect)
- setPackageName(CharSequence)
- setClassName(CharSequence)
- setContentDescription(CharSequence)
- setEnabled(boolean)
- setClickable(boolean)
- setFocusable(boolean)
- setFocused(boolean)
- setLongClickable(boolean)
- setSelected(boolean)
- setContextClickable(boolean)
子类应该覆盖这个方法,调用super实现,并设置额外的属性。
AccessibilityNodeInfo
此类表示窗口内容的节点以及可从其源请求的操作。从AccessibilityService窗口的角度来看, 内容被呈现为可访问性节点信息的树,其可以或可以不将一对一映射到视图层次结构。换句话说,自定义视图可以自动报告为可访问性节点信息的树。
以下摘自
http://android.xsoftlab.net/reference/android/view/accessibility/AccessibilityNodeInfo.html
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACTION_ACCESSIBILITY_FOCUS | Action that gives accessibility focus to the node. | |||||||||
String | ACTION_ARGUMENT_COLUMN_INT | Argument for specifying the collection column to make visible on screen. | |||||||||
String | ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN | Argument for whether when moving at granularity to extend the selection or to move it otherwise. | |||||||||
String | ACTION_ARGUMENT_HTML_ELEMENT_STRING | Argument for which HTML element to get moving to the next/previous HTML element. | |||||||||
String | ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT | Argument for which movement granularity to be used when traversing the node text. | |||||||||
String | ACTION_ARGUMENT_ROW_INT | Argument for specifying the collection row to make visible on screen. | |||||||||
String | ACTION_ARGUMENT_SELECTION_END_INT | Argument for specifying the selection end. | |||||||||
String | ACTION_ARGUMENT_SELECTION_START_INT | Argument for specifying the selection start. | |||||||||
String | ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE | Argument for specifying the text content to set. | |||||||||
int | ACTION_CLEAR_ACCESSIBILITY_FOCUS | Action that clears accessibility focus of the node. | |||||||||
int | ACTION_CLEAR_FOCUS | Action that clears input focus of the node. | |||||||||
int | ACTION_CLEAR_SELECTION | Action that deselects the node. | |||||||||
int | ACTION_CLICK | Action that clicks on the node info. | |||||||||
int | ACTION_COLLAPSE | Action to collapse an expandable node. | |||||||||
int | ACTION_COPY | Action to copy the current selection to the clipboard. | |||||||||
int | ACTION_CUT | Action to cut the current selection and place it to the clipboard. | |||||||||
int | ACTION_DISMISS | Action to dismiss a dismissable node. | |||||||||
int | ACTION_EXPAND | Action to expand an expandable node. | |||||||||
int | ACTION_FOCUS | Action that gives input focus to the node. | |||||||||
int | ACTION_LONG_CLICK | Action that long clicks on the node. | |||||||||
int | ACTION_NEXT_AT_MOVEMENT_GRANULARITY | Action that requests to go to the next entity in this node’s text at a given movement granularity. | |||||||||
int | ACTION_NEXT_HTML_ELEMENT | Action to move to the next HTML element of a given type. | |||||||||
int | ACTION_PASTE | Action to paste the current clipboard content. | |||||||||
int | ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY | Action that requests to go to the previous entity in this node’s text at a given movement granularity. | |||||||||
int | ACTION_PREVIOUS_HTML_ELEMENT | Action to move to the previous HTML element of a given type. | |||||||||
int | ACTION_SCROLL_BACKWARD | Action to scroll the node content backward. | |||||||||
int | ACTION_SCROLL_FORWARD | Action to scroll the node content forward. | |||||||||
int | ACTION_SELECT | Action that selects the node. | |||||||||
int | ACTION_SET_SELECTION | Action to set the selection. | |||||||||
int | ACTION_SET_TEXT | Action that sets the text of the node. | |||||||||
int | FOCUS_ACCESSIBILITY | The accessibility focus. | |||||||||
int | FOCUS_INPUT | The input focus. | |||||||||
int | MOVEMENT_GRANULARITY_CHARACTER | Movement granularity bit for traversing the text of a node by character. | |||||||||
int |