2018-6-30 02:25:25 测试补充:
This commit is contained in:
@ -12,6 +12,7 @@ import android.text.style.ClickableSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.gamecenter.R;
|
||||
|
||||
public class ExpendTextView extends android.support.v7.widget.AppCompatTextView {
|
||||
@ -50,6 +51,10 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
|
||||
}
|
||||
}
|
||||
|
||||
public void setExpendText(String text) {
|
||||
this.mExpendText = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(CharSequence text, BufferType type) {
|
||||
mInitLayout = true;
|
||||
@ -75,7 +80,7 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
|
||||
for (int i = lastText.length() - 1; i > 0; i--) {
|
||||
CharSequence sequence = lastText.subSequence(0, i);
|
||||
float w = paint.measureText(sequence.toString());
|
||||
if (viewWidth - w > expendTextWidth) {
|
||||
if (viewWidth - w - DisplayUtils.dip2px(5) > expendTextWidth) {
|
||||
content = mSnapshotText.subSequence(start, lastLineStart + i) + mExpendText;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user