2010-05-27 79 views

回答

0

不要這麼想,但如果您只希望文本使用一行,您可以閱讀here以正確處理它。

0

退房this話題

...您可以創建TextView2的文字大小噴漆的對象,並使用BREAKTEXT()來衡量多少個字符將適合你的TextView2的寬度......

它爲我

6

您可以使用方法:getEllipsisCount

public static boolean isTextTruncated(String text, TextView textView) 
    { 
     if (textView != null && text != null) 
     { 

      Layout layout = textView.getLayout(); 
      if (layout != null) 
      { 
       int lines = layout.getLineCount(); 
       if (lines > 0) 
       { 
        int ellipsisCount = layout.getEllipsisCount(lines - 1); 
        if (ellipsisCount > 0) 
        { 
         return true; 
        } 
       } 
      } 

     } 
     return false; 
    } 

我發現下面的相關職位的答案:

Check if textview is ellipsized in android

+0

感謝lot..helped我很多.. – AndroidMech 2015-06-26 11:58:11

+1

什麼用PARAM字符串text'的'? – 2017-11-09 05:15:04

相關問題