标签:
1 private void setText(CharSequence text, BufferType type,
2 boolean notifyBefore, int oldlen) {
3 ……
4 if (text instanceof Spannable) {
5 Spannable sp = (Spannable) text;
6
7 ……
8 if (mMovement != null) {
9 mMovement.initialize(this, (Spannable) text);
10 //文本是不是Editable的。
11 if(this instanceof Editable)
12 //设定光标位置
13 Selection.setSelection((Spannable)text, text.length());
14
15 ……
16 }
1 Log.d("TextView", "(type == BufferType.EDITABLE)="+(type == BufferType.EDITABLE));
2 if(type == BufferType.EDITABLE){
3 Log.d("TextView","Format text.Set cursor to the end ");
4 Selection.setSelection((Spannable)text, text.length());
5 }
1 CharSequence text = editText.getText();
2 //Debug.asserts(text instanceof Spannable);
3 if (text instanceof Spannable) {
4 Spannable spanText = (Spannable)text;
5 Selection.setSelection(spanText, text.length());
6 }
标签:
原文地址:http://www.cnblogs.com/Free-Thinker/p/4351067.html