【发布时间】:2011-02-26 02:01:18
【问题描述】:
myInput.setText(myInput.getText().replace(myInput.getSelectionStart(), myInput.getSelectionEnd(), myText));
myInput.setSelection(myInput.getSelectionStart() + myText.length(), myInput.getSelectionEnd() + myText.length())
我问是因为我认为这段代码比它需要的要长得多 - 有没有像 myInput.insertTextAtCursor(myText) 这样更短的东西,还是每个人都这样做?
【问题讨论】: