File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
packages/ui-canvas/platforms/android/java/com/akylas/canvas Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -63,12 +63,13 @@ public static android.text.StaticLayout createEllipsizeStaticLayout(android.text
63
63
int i = 0 ;
64
64
float lineHeight = staticLayout .getLineBottom (i ) - staticLayout .getLineTop (i );
65
65
float totalHeight = lineHeight * lineCount ;
66
-
67
- while (totalHeight > maxHeight && maxLines > 0 ) {
68
- maxLines --;
69
- i ++;
70
- lineHeight = staticLayout .getLineBottom (i ) - staticLayout .getLineTop (i );
71
- totalHeight = lineHeight * maxLines ;
66
+ if (maxLines > 1 ) {
67
+ while (totalHeight > maxHeight && maxLines > 0 ) {
68
+ maxLines --;
69
+ i ++;
70
+ lineHeight = staticLayout .getLineBottom (i ) - staticLayout .getLineTop (i );
71
+ totalHeight = lineHeight * maxLines ;
72
+ }
72
73
}
73
74
// Check if truncation is needed
74
75
if (maxLines < lineCount ) {
You can’t perform that action at this time.
0 commit comments