[英]How do you check whether a button is enabled or not in Android?
在 Android 中,我可以通過執行以下操作來設置啟用或禁用按鈕:
button.setEnabled(true);
或button.setEnabled(false);
如何檢查啟用的按鈕 state 是真還是假?
時不時地閱讀手冊並沒有什么壞處:
http://developer.android.com/reference/android/view/View.html#isEnabled%28%29
例子:
ImageButton myButton = (ImageButton) findViewById(R.id.epic_button);
if (myButton.isEnabled()){
//then the button is enabled.
}
button.isEnabled()
如果啟用則返回 true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.