문제

In Android I can set a button to be enabled or disabled by doing the following:

button.setEnabled(true); or button.setEnabled(false);

How do I check whether the button enabled state is true or false?

도움이 되었습니까?

해결책

Reading the manual every now and then doesn't hurt:

http://developer.android.com/reference/android/view/View.html#isEnabled%28%29

Example:

ImageButton myButton = (ImageButton) findViewById(R.id.epic_button);

if (myButton.isEnabled()){
    //then the button is enabled.
}

다른 팁

button.isEnabled() 

returns true if enabled

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top