private void setText(CharSequence text, BufferType type,
boolean notifyBefore, int oldlen) {
……
if (text instanceof Spannable) {
Spannable sp = (Spannable) text;
……
if (mMovement != null) {
mMovement.initialize(this, (Spannable) text);
//文本是不是Editable的。
if(this instanceof Editable)
//设定光标位置
Selection.setSelection((Spannable)text, text.length());
……
}
Log.d("TextView", "(type == BufferType.EDITABLE)="+(type == BufferType.EDITABLE));
if(type == BufferType.EDITABLE){
Log.d("TextView","Format text.Set cursor to the end ");
Selection.setSelection((Spannable)text, text.length());
}
CharSequence text = editText.getText();
//Debug.asserts(text instanceof Spannable);
if (text instanceof Spannable) {
Spannable spanText = (Spannable)text;
Selection.setSelection(spanText, text.length());
}