Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2015] Android: Label ellipsize not working when breaking line with

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-05-30T17:58:38.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsAndroid, bug, label
ReporterAndré Perazzi
AssigneeMostafizur Rahman
Created2013-05-30T14:47:09.000+0000
Updated2016-03-08T07:40:57.000+0000

Description

When the label's property ellipsize is set true, if the text has a line break '\n', the property doesn't work. Steps to reproduce: 1 - Create a label with a fixed width and height and ellipsize set true. 2 - Put a long text in it. IF there is no \n in the text, the label will get ellipsized with "..." . IF there is a \n in the text, it won't. Ti.UI.createLabel({ textAlign:'left', width:'auto', height:'19dp', ellipsize:true, top:'45dp', color:'black', text: 'sfashdfgaskdfhaslkdfjhaslkjdfhaslkjdfhlaskjhfdlk \n sajhdflksajhflkdjhfalskjdfhalskjhdflksajhfdlkashjdlkfdjh', font:{fontSize:'12dp',fontWeight:'normal',fontFamily:'Arial'} });

Comments

  1. Carter Lathrop 2013-05-30

    Andre, I could not reproduce the issue you are seeing. I created my own test case which I pasted below. This is the proper way to use ellipsize. Would you mind trying it and letting me know if your problem persists? Also please provide the android version you are testing the code on.
       var parentView = Ti.UI.createWindow({
       	backgroundColor: 'gray'
       	});
       
       var label = Ti.UI.createLabel({	
       textAlign:'left',
       width:'100dp',
       height:'15dp',
       ellipsize: true,
       top:'45dp',
       color:'black',
       text: 'The quick brown fox jumped over the lazy dog. /n The quick brown fox jumped over the lazy dog again.',
       wordWrap: false,
       font:{fontSize:'12dp',fontWeight:'normal',fontFamily:'Arial'}
       });
       
       parentView.add(label);
       parentView.open();
       
    Regards, Carter

JSON Source