Disable EditText blinking cursor

前端 未结 10 2003
耶瑟儿~
耶瑟儿~ 2020-11-28 02:27

Does anyone know how to disable the blinking cursor in an EditText view?

10条回答
  •  借酒劲吻你
    2020-11-28 03:15

    1. Change focus to another view (ex: Any textview or Linearlayout in the XML) using

      android:focusableInTouchMode="true"
      android:focusable="true"
      
    2. set addTextChangedListener to edittext in Activity.

    3. and then on aftertextchanged of Edittext put edittext.clearFocus();

    This will enable the cursor when keyboard is open and disable when keyboard is closed.

提交回复
热议问题