简体   繁体   English

当我单击禁用复选框时显示Toast消息

[英]Display the Toast message when i was clicking the disabled check box

I used web service, I get the check box dynamically. 我使用了Web服务,因此可以动态获取该复选框。 But the check boxes are enabled by one by one. 但是复选框是一一启用的。 Suppose if i click first check box second check box only enable others are disabled, if check the second check box third check box only enable others are disabled and so on... So I need to display Toast if i click the disabled check box. 假设如果我单击第一个复选框,则第二个复选框仅禁用其他复选框,如果选中第二个复选框,第三个复选框仅禁用其他复选框,以此类推...因此,如果我单击禁用的复选框,则需要显示Toast。 Thanks. 谢谢。

如果手动禁用取消选中CheckBoxes,则应该可以通过单击.isEnabled()的视图状态来获取它。

Something like 就像是

CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);


     if (checkBox.isChecked()) {

     }else{
   //display toast here...

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM