How to empty edittext without setText(“”);

后端 未结 5 1643
青春惊慌失措
青春惊慌失措 2021-01-07 20:24

Is there a way to reset the edittext value without setting text like:

((EditText) findViewById(R.id.yoursXmlId)).setText(\"\");

EDI

5条回答
  •  悲&欢浪女
    2021-01-07 20:52

    A function for that would be:

    fun setTextViewEmpty(textView: TextView){
    (textView as EditText ).text.clear()   }
    

    inspired by this

提交回复
热议问题