修复数组越界问题
This commit is contained in:
@ -90,7 +90,8 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
|
||||
SpannableStringBuilder msp = new SpannableStringBuilder(content);
|
||||
int length = msp.length();
|
||||
int startPosition = length - mExpendText.length();
|
||||
msp.replace(startPosition < 0 ? 0 : startPosition, length, mExpendText);
|
||||
startPosition = startPosition < 0 ? 0 : startPosition;
|
||||
msp.replace(startPosition, length, mExpendText);
|
||||
msp.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
@ -109,7 +110,7 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
|
||||
mExpandCallback.onExpand();
|
||||
}
|
||||
}
|
||||
}, length - mExpendText.length(), length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}, startPosition, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
setText(msp);
|
||||
setMovementMethod(CustomLinkMovementMethod.getInstance());
|
||||
|
||||
Reference in New Issue
Block a user