EditText中输入的内容不能小于一位数字切不能以0开头

 num.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                if (num.toString().equals("0") || s.toString().startsWith("0")
                    || num.toString().equals("") || s.toString().trim().length() == 0) {
                    num.setText("1");
                }
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                if (fbId == 0) {
                    sendToast();
                } else {
                    getManureFromService(WheelMain.N_num, WheelMain.P_num, WheelMain.K_num);
                }
            }
        });

你可能感兴趣的:(EditText中输入的内容不能小于一位数字切不能以0开头)