效果图对比
下面是设置普通文本的效果对比图:
解决方案
重新测量文字宽度,设置换行:
private void initAutoSplitTextView() {
mTv.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mTv.getViewTreeObserver().removeOnGlobalLayoutListener(this);
final CharSequence newText = autoSplitText(mTv);
if (!TextUti

本文介绍了在Android中解决TextView使用SpannableString时自动换行出现空白问题的方法,通过对比效果图展示解决方案,即重新测量文字宽度以避免换行后的空隙。
最低0.47元/天 解锁文章
3635

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



