Android disabling a button
I can't figure out why this wouldn't set a button to be disabled?
btn开发者_如何学编程SaturdayStartTime = (Button)findViewById(R.id.btnSaturdayStartTime);
btnSaturdayStartTime.setEnabled(false);
When I click on the button it still fires the listener.
Try using btnSaturdayStartTime.setClickable(false).
See setClickable from the docs.
try the method : Button.setClickable(false) ;
or delete the listener on your button like this : button.setOnClickListener(null);
Maybe the button is recreated or re-enabled between you disabling it an the user click interaction. Are you sure you are disabling the right button? What version of Android are you targeting?
精彩评论