Re: [問題] TextView 多餘的text呈現 ... 效果

看板AndroidDev作者 (martinboy)時間11年前 (2014/07/21 14:22), 11年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
這是小弟我之前做的方式 用程式去計算行數再決定超過多少行時顯示... textview的width和height都設定成wrap_content textview.post(new Runnable() { @Override public void run() { int lineCount = textview.getLineCount(); if (lineCount <= 6) { textview.setEllipsize(null); } else { textview.setMaxLines(6); textview.setEllipsize(TextUtils.TruncateAt.END); } } }); -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.227.33.52 ※ 文章網址: http://www.ptt.cc/bbs/AndroidDev/M.1405923776.A.8C0.html ※ 編輯: martinboy10 (125.227.33.52), 07/21/2014 14:24:18 ※ 編輯: martinboy10 (125.227.33.52), 07/21/2014 14:26:06
文章代碼(AID): #1JpB70Z0 (AndroidDev)