屏蔽Button setClickable和setEnabled
2016-11-30 21:17
357 查看
今天想让按键暂时无效,满足一定条件下才可以被用户按到。最初以为是setClickable,谁知搞错了。
请看手册:
这个函数的意思是让按键按一下。比如弄一个定时器,然后在手机上模拟,多长时间到了让按键自己按一下,而不是手动去按,可以用这个函数。
这个函数才是真正的,让一个按键可以被用户按,或者不可按。如果设为false,按键则会变成灰色的,按上去也没反应。当设为true后,才会正常使用。这正是我找的函数。
请看手册:
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开发 屏蔽Button setClickable和setEnabled
- Android开发 屏蔽Button setClickable和setEnabled
- Android开发 屏蔽Button setClickable和setEnabled
- Android开发 屏蔽Button setClickable和setEnabled区别
- 如何屏蔽Button setClickable与setEnabled
- button的setClickable 和 setEnabled 区别
- Android开发笔记之:如何屏蔽Button setClickable与setEnabled
- IOS 使用自定义手势屏蔽按钮解决方法/UITapGestureRecognizer屏蔽Button
- 屏蔽Button按钮对Enter回车键的响应 及实现Enter->Tab效果
- Android ListView中的Button屏蔽onItemClick事件解决办法
- cocos2d-x-3.9,js对ccs的Listview的item的Button如果有setEnabled 操作,在android手机的微信里面打开会出现上下滑动变卡
- 屏蔽Button按钮对Enter回车键的响应 及实现Enter->Tab效果
- setFocusable , setEnabled ,setClickable 区别
- 【iOS】Button点击事件被其父视图点击手势UITapGestureRecognizer的屏蔽问题
- android中setClickable,setEnabled,setFocusable的含义及区别
- 关于安卓View的setEnabled和setClickable的思考
- setEnabled() 和 setClickable() 的区别
- android中setClickable,setEnabled,setFocusable的含义及区别
- 利用dialog.getButton().setEnabled()实现按钮使能
- UITapGestureRecognizer会屏蔽掉Button的点击事件