Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 textView,里面有一些文字。我想删除最后 4 个字符,然后添加更多文本。我试着这样做。
textViewObject.append("\b\b\b\b new text that I am adding");
但是 \b 不是退格,而是在文本字段中显示为小方块。有谁可以帮我离开这里吗?
您应该能够通过抓取除最后 4 个字符之外的所有文本然后附加新文本来实现相同的效果。
String textViewText = textViewObject.getText().toString(); textViewObject.setText(textViewText.substring(0, textViewText.getLength() - 4) + " new text that I am adding");