欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android開發(fā)筆記之:如何屏蔽Button setClickable與setEnabled

 更新時(shí)間:2013年05月28日 10:54:47   作者:  
本篇文章是對(duì)在Android中,如何屏蔽Button setClickable與setEnabled的方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
今天想讓按鍵暫時(shí)無效,滿足一定條件下才可以被用戶按到。最初以為是setClickable,誰知搞錯(cuò)了。
請(qǐng)看手冊(cè):
復(fù)制代碼 代碼如下:

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

這個(gè)函數(shù)的意思是讓按鍵按一下。比如弄一個(gè)定時(shí)器,然后在手機(jī)上模擬,多長(zhǎng)時(shí)間到了讓按鍵自己按一下,而不是手動(dòng)去按,可以用這個(gè)函數(shù)。
復(fù)制代碼 代碼如下:

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.

這個(gè)函數(shù)才是真正的,讓一個(gè)按鍵可以被用戶按,或者不可按。如果設(shè)為false,按鍵則會(huì)變成灰色的,按上去也沒反應(yīng)。當(dāng)設(shè)為true后,才會(huì)正常使用。這正是我找的函數(shù)。

相關(guān)文章

最新評(píng)論