我把一个spannable对象分成3个部分,做不同的操作,然后我需要合并它们。
Spannable str = editText.getText();
Spannable selectionSpannable = new SpannableStringBuilder(str, selectionStart, selectionEnd);
Spannable endOfModifiedSpannable = new SpannableStringBuilder(str, selectionEnd, editText.getText().length());
Spannable beginningOfModifiedSpannable = new SpannableStringBuilder(str, 0, selectionStart);
我该怎么做?我还没有找到所需的方法或构造函数。
最佳答案
你可以用这个:
TextUtils.concat(span1, span2);
http://developer.android.com/reference/android/text/TextUtils.html#concat(java.lang.CharSequence...)
关于android - 如何合并一些可跨越的对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4605588/