Spanned(可附加标记的字符序列)
**
* This is the interface for text that has markup objects attached to
* ranges of it. Not all text classes have mutable markup or text;
* see {@link Spannable} for mutable markup and {@link Editable} for
* mutable text.
*/
public interface Spanned
extends CharSequence
Spannable (可加或去除标记的字符序列)
/**
* This is the interface for text to which markup objects can be attached and detached.
* Not all Spannable classes have mutable text;
* see {@link Editable} for that.
*/
public interface Spannable
extends Spanned
Editable (内容和标记都可变的字符序列)
/**
* This is the interface for text whose content and markup can be changed
*/
public interface Editable
extends CharSequence, GetChars, Spannable, Appendable
Appendable(字符文本可改变的接口)
/**
* An object to which <tt>char</tt> sequences and values can be appended.
*/
public interface Appendable
SpannableString (内容不可变,标记可附加或去掉)
/**
* This is the class for text whose content is immutable but to which
* markup objects can be attached and detached.
* For mutable text, see {@link SpannableStringBuilder}.
*/
public class SpannableString
extends SpannableStringInternal
implements CharSequence, GetChars, Spannable
SpannableString只有以下3个方法
public void setSpan(Object what, int start, int end, int flags) {
super.setSpan(what, start, end, flags);
}
public void removeSpan(Object what) {
super.removeSpan(what);
}
public final CharSequence subSequence(int start, int end) {
return new SpannableString(this, start, end);
}
SpannableStringBuilder(内容和标记都可变)
/**
* This is the class for text whose content and markup can both be changed.
*/
public class SpannableStringBuilder implements CharSequence, GetChars, Spannable, Editable,
Appendable, GraphicsOperations
SpannableStringBuilder有append,insert, setSpan , removeSpan方法
本文深入探讨了Android中用于处理带标记文本的接口和类,包括Spanned、Spannable、Editable及其实现类如SpannableString和SpannableStringBuilder。详细介绍了这些类的功能差异,以及如何使用它们来创建和修改文本的布局和样式。
1419

被折叠的 条评论
为什么被折叠?



