EditText and InputFilter cause repeating text

前端 未结 5 1928
野性不改
野性不改 2021-02-19 05:43

I\'m trying to implement an EditText that limits input to alpha chars only [A-Za-z].

I started with the InputFilter method from this post. When I type \"a%\" the text d

5条回答
  •  無奈伤痛
    2021-02-19 06:13

    Bingo, I found the problem!

    When I use android:cursorVisible="false" on the EditText the start and dstart parameters don't match up correctly.

    The start parameter is still always 0 for me, but the dstart parameter is also always 0 so it works out as long as I use .replaceAll(). This is contrary to what this post says so I don't quite understand why but at least I can build something that works now!

提交回复
热议问题