In Android, how to make Login button disable with respect to EditText?

前端 未结 9 2182
猫巷女王i
猫巷女王i 2020-12-28 09:50

If EditText is empty then Login Button has to be disabled. And if EditText has some texts then Login Button has to be ena

9条回答
  •  执笔经年
    2020-12-28 10:14

    try this

      if(s1.equals("") && s2.equals(""))
        {
            b.setEnabled(true);
            // to change color of the button you need to apply style to the button[here refer custom bg][1]
        }
        else
        {
            b.setEnabled(false);
           //do nothing or display toast msg
        }
    

提交回复
热议问题