TextView相关
实现出现字符省略号
TextView自带的可以通过 android:ellipsize="end" android:singleLine="true"
android:maxWidth="90dp"
判断是否有省略号
private void hideExpondBoxWhenNoellipsized(TextView tv, View cb) { if(tv == null || cb == null){ return; } Layout l = tv.getLayout(); if (l != null) { int lines = l.getLineCount(); if (lines > 0) { if (l.getEllipsisCount(lines - 1) > 0) { // Log.d("", "Text is ellipsized"+lines); // tv.setEllipsize(null); cb.setVisibility(View.VISIBLE); } else { // Log.d("", "Text is not ellipsized"+lines); // tv.setEllipsize(TextUtils.TruncateAt.END); cb.setVisibility(View.GONE); } } } }