1 Layout l = textview.getLayout();2 if ( l != null){3 int lines = l.getLineCount();4 if ( lines > 0)5 if ( l.getEllipsisCount(lines-1) > 0)6 Log.d(TAG, "Text is ellipsized");7 }
textview有个特性,是当改变文字的时候getlayout为null,需要做一定的延时再获取
而且获取后不能在子线程中更新ui,会报错
本文共 323 字,大约阅读时间需要 1 分钟。
1 Layout l = textview.getLayout();2 if ( l != null){3 int lines = l.getLineCount();4 if ( lines > 0)5 if ( l.getEllipsisCount(lines-1) > 0)6 Log.d(TAG, "Text is ellipsized");7 }
textview有个特性,是当改变文字的时候getlayout为null,需要做一定的延时再获取
而且获取后不能在子线程中更新ui,会报错
转载地址:http://wdesl.baihongyu.com/