问题描述:
本来想着用TextView来显示某个版本号,结果版本号异常的长,
我的情况是放在GridLayout中,有的人可能是TableLayout,查了查网友的答案,有的设置TextView inputType多行multiline,省略号ellipsesize。
不过对我都没啥用。
解决办法:
后来想着还是使用换行符吧,检测放入的字符串的长度,然后加个换行符进去就行。
其他啥都不设置。
if( text.length()>30){
StringBuilder sb = new StringBuilder(text);
sb.insert(30,'\n');
display.setText(sb);
}else{
display.setText(text);
}