android中TextView.getText()的返回类型是什么?

Chr*_*ava 1 xml android textview charsequence

为什么要TextView.getText()返回CharSequence而不是String
(String是CharSequence的实现)

San*_*nta 8

因为它可能包含一个Spannable对象.来自doc:

如果setText()使用参数BufferType.SPANNABLEor 调用BufferType.EDITABLE,则可以将此方法的返回值分别转换为 SpannableEditable.