2018.11.15

2018.11.15

private inner class EditWatcher : TextWatcher{
        override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {

        }

        override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {

        }

        override fun afterTextChanged(s: Editable?) {
            var str = s.toString()
            if(str.indexOf("\r")>=0 || str.indexOf("\n") >= 0){
                str = str.replace("\r","").replace("\n","")
            }
            if (str.length >= 11){
                tv_phone.text = "your number is $str"
            }
        }
    }

2018.11.15_第1张图片

你可能感兴趣的:(琉璃神社)