editText.doOnTextChanged { text, start, before, count ->
Log.i("text: |$text|, start: $start, before: $before, count: $count")
if (before == 1 && count == 2) {
label.append("\n${text?.first()}")
editText.text.delete(0, 1)
}
}
두 번째 글자가 시작할 때 첫 번째 글자를 가져오고, 두 번째 글자의 편집상태는 유지되게 코드를 짰습니다.
근데 분명 delete 한 글자가 되살아 납니다.
천지인 키보드로 `김밥`을 입력하고 로그를 찍었습니다.. (|| 는 임의로 넣은 겁니다)
||, start: 0, before: 1, count: 0
|ㄱ|, start: 0, before: 0, count: 1
|기|, start: 0, before: 1, count: 1
|깅|, start: 0, before: 1, count: 1
|김|, start: 0, before: 1, count: 1
|김ㅂ|, start: 0, before: 1, count: 2
|ㅂ|, start: 0, before: 1, count: 0
|김비|, start: 0, before: 1, count: 2
|비|, start: 0, before: 1, count: 0
|김바|, start: 0, before: 1, count: 2
|바|, start: 0, before: 1, count: 0
|김밥|, start: 0, before: 1, count: 2
|밥|, start: 0, before: 1, count: 0
되살아난 `김` 때문에 TextView에는 이렇게만 찍히고 있습니다.
김
김
김
김