请看手册:
代码如下:
public void setClickable (boolean clickable)
Since: API Level 14
Sets whether this node is clickable.
Note: Cannot be called from an AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.
Parameters
clickable True if the node is clickable.
Throws
IllegalStateException If called from an AccessibilityService.
public void setContentDescription (CharSequence contentDescr
这个函数的意思是让按键按一下。比如弄一个定时器,然后在手机上模拟,多长时间到了让按键自己按一下,而不是手动去按,可以用这个函数。
代码如下:
public void setEnabled (boolean enabled)
Since: API Level 14
Sets whether this node is enabled.
Note: Cannot be called from an AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.
Parameters
enabled True if the node is enabled.
Throws
IllegalStateException If called from an AccessibilityService.
这个函数才是真正的,让一个按键可以被用户按,或者不可按。如果设为false,按键则会变成灰色的,按上去也没反应。当设为true后,才会正常使用。这正是我找的函数。
您可能感兴趣的文章:Android控件系列之RadioButton与RadioGroup使用方法Android控件系列之Button以及Android监听器使用介绍Android定制RadioButton样式三种实现方法Android自定义格式显示Button的布局思路Android中button实现onclicklistener事件的两种方式Android RadioButton单选框的使用方法Android控件之ToggleButton的使用方法Android 控件(button)对齐方法实现详解Android点击Button实现功能的几种方法总结Android实现点击Button产生水波纹效果