- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
public static String ellipsizeText(String text, Context cnt) {
int COUNT_OF_CHARACTERS_LDPI = 10;
int COUNT_OF_CHARACTERS_MDPI = 20;
int COUNT_OF_CHARACTERS_HDPI = 30;
String ellipsizeT = "...";
String newText = text;
switch (cnt.getResources().getDisplayMetrics().densityDpi) {
case DisplayMetrics.DENSITY_LOW:
if (text.length() > COUNT_OF_CHARACTERS_LDPI) {
newText = text.substring(0, COUNT_OF_CHARACTERS_LDPI) + ellipsizeT;
}
break;
case DisplayMetrics.DENSITY_MEDIUM:
if (text.length() > COUNT_OF_CHARACTERS_MDPI) {
newText = text.substring(0, COUNT_OF_CHARACTERS_MDPI) + ellipsizeT;
}
break;
case DisplayMetrics.DENSITY_HIGH:
if (text.length() > COUNT_OF_CHARACTERS_HDPI) {
newText = text.substring(0, COUNT_OF_CHARACTERS_HDPI) + ellipsizeT;
}
break;
}
return newText;
}
Lure Of Chaos 15.07.2011 17:21 # +1
gu-est 15.07.2011 18:10 # −10
guest 15.07.2011 19:20 # −2
bugmenot 15.07.2011 19:37 # +5
был аноном, стал хомячком
Lure Of Chaos 15.07.2011 22:57 # +1
но анонировать своим пиписюнчиком не перестал
guest 16.07.2011 12:17 # −9
Lure Of Chaos 16.07.2011 12:46 # +2