修复一些消息弹窗的问题

This commit is contained in:
chenjuntao
2018-08-21 14:29:49 +08:00
parent 40d28948e1
commit e27f061a92
6 changed files with 59 additions and 36 deletions

View File

@ -40,4 +40,20 @@ public class StringUtils {
return displayName + "(" + description + ")";
}
/**
* 截取字符串部分长度,超出的以 "..." 代替
*
* @param text 字符串内容
* @param maxLength 最大长度
* @return 修饰后的字符串
*/
public static String shrinkStringWithDot(String text, int maxLength) {
if (TextUtils.isEmpty(text)) return "";
if (text.length() > maxLength) {
text = text.substring(0, maxLength) + "...";
}
return text;
}
}