Today want to let the button temporarily invalid, meet certain conditions before users can be pressed. Originally thought is setclickable, who knows the mistake.
Please read the manual:
Copy Code code as follows:
public void Setclickable (Boolean clickable)
SINCE:API Level 14
Sets Whether this node is clickable.
Note:cannot is called from the Accessibilityservice. This class is made immutable before being delivered to a accessibilityservice.
Parameters
Clickable True If the node is clickable.
Throws
IllegalStateException If called from Accessibilityservice.
public void Setcontentdescription (Charsequence contentdescr
This function means to press the button. For example, to get a timer, and then simulate on the phone, how long to let the button click on their own, rather than manually to press, you can use this function.
Copy Code code as follows:
public void SetEnabled (Boolean enabled)
SINCE:API Level 14
Sets Whether this node is enabled.
Note:cannot is called from the Accessibilityservice. This class is made immutable before being delivered to a accessibilityservice.
Parameters
Enabled True If the node is enabled.
Throws
IllegalStateException If called from Accessibilityservice.
This function is true, so that a button can be pressed by the user, or not. If set to False, the key will turn gray and no response. When set to true, it will not work properly. This is the function I'm looking for.