TextView doesn't wrap text correctly after resize
I extended FrameLayout and overrode the onLayout() method. From there I call layout() on a TextView child to resize and relocate at will, but the wrapping of the text do开发者_JAVA百科esn't recalculate after the resize.
I've already tried setText() and setWidth().
Sure there is something I'm doing wrong. Any ideas?
You can give a try to autofittextview.
call setEllipsize(null) to recalculate the wrapping.
Building on Aladin Q's answer, this is what I used to handle pre ICS and ICS:
// pre ICS
if (Integer.parseInt(Build.VERSION.SDK) < 14) {
setEllipsize(null);
// ICS and above
} else {
setEllipsize(TruncateAt.END);
}
setEllipsize(null) will work well before "ICS" (Build.VERSION.SDK_INT < 14) but not after.
See this post for details.
加载中,请稍侯......
精彩评论