Android中TextView输入字数统计和限制 ??????????????? selectionStart content.getSelectionStart()
Android中TextView输入字数统计和限制
??????????????? selectionStart = content.getSelectionStart();
??????????????? selectionEnd = content.getSelectionEnd();
????????????????if (temp.length() > num) {
??????????????????? s.delete(selectionStart - 1, selectionEnd);
??????????????????? int tempSelection = selectionEnd;
??????????????????? content.setText(s);
??????????????????? content.setSelection(tempSelection);//设置光标在最后
??????????????? }
??????????? }
???});
