Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13895] Android: Text wrapping in a label is not showing ellipsis (regression)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-06-23T01:31:09.000+0000
Affected Version/sRelease 5.2.2
Fix Version/sRelease 6.1.1
ComponentsAndroid
LabelsSupportTeam, look1, regression
ReporterJuan Perales
AssigneeJoshua Quick
Created2013-05-17T07:56:54.000+0000
Updated2017-06-23T22:10:31.000+0000

Description

Problem Description

When you create a label with a big text and the ellipsize set to true, the ellipsis won't be shown.

Test Case

1. Create a classic project 2. Paste this code as app.js:
 
var win = Ti.UI.createWindow({
	backgroundColor : 'white',
	exitOnClose : true,
	fullscreen : false,
	layout : 'vertical',
	title : 'Label Demo'
});
var label2 = Ti.UI.createLabel({
	color : 'blue',
	text : 'A long label with a few line breaks and unicode (UTF8) symbols such as a white chess piece \u2655 and the euro symbol \u20ac looks like this! ',
	textAlign : Ti.UI.TEXT_ALIGNMENT_LEFT,
	//top : 30,
	width : 200,
	height : 100,
	backgroundColor:'red',
	lines: 1,
	//layout:'horizontal',
	//horizontalWrap: true,
	//wordWrap: true,
	ellipsize: true
	
});
win.add(label2);
win.open(); 
3. Run it in a device. Expected: Truncated text in the label without ellipsis Actual: You will see the truncated text in the label without ellipsis.

Attachments

FileDateSize
Captura de pantalla 2013-05-17 a la(s) 09.27.01.png2013-05-17T07:56:54.000+000017176
Captura de pantalla 2013-05-17 a la(s) 09.28.55.png2013-05-17T07:56:54.000+000017320

Comments

  1. Ashraf Abu 2016-06-08

    [~jnaher] Please use this as a workaround for now:-
       var label2 = Ti.UI.createLabel({
       	color : 'blue',
       	text : 'A long label with a few line breaks and unicode (UTF8) symbols such as a white chess piece \u2655 and the euro symbol \u20ac looks like this! ',
       	textAlign : Ti.UI.TEXT_ALIGNMENT_LEFT,
       	//top : 30,
       	width : 200,
       	height : 100,
       	backgroundColor:'red',
       	lines: 1,
       	//layout:'horizontal',
       	//horizontalWrap: true,
       	wordWrap: false,
       	ellipsize: true
       	
       });
       
    When the property wordWrap is set to false and ellipsize is set to true, it will behave as expected.
  2. Ashraf Abu 2016-06-23

    There seems to be a related Android ticket for this: https://code.google.com/p/android/issues/detail?id=882 Thus, as mentioned in the solution earlier, setting wordWrap: false would solve the issue. Source code for that is here: https://github.com/appcelerator/titanium_mobile/blob/23c9e3fb93694950d33a8b4b79fbb2129ff9001b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUILabel.java#L246-L247 Resolving issue as there is already a workaround available and it's seems to be an Android issue.
  3. Marian Kucharcik 2016-10-11

    Hi guys, any news on this? I'm facing a problem with truncating, suggested idea partially works - it truncates the end, but also centers label in the middle(I have height and width set for label), so I see first sentence of a article. Have you any idea how to fix it? Thank you
  4. Joshua Quick 2017-06-19

    PR (6.1.x): https://github.com/appcelerator/titanium_mobile/pull/9161
  5. Lokesh Choudhary 2017-06-23

    FR Passed for 6.1.1
  6. Joshua Quick 2017-06-23

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9175
  7. Lokesh Choudhary 2017-06-23

    FR passed for master.
  8. Lokesh Choudhary 2017-06-23

    Verified the fix. Test info in the PR. Closing. Studio Ver: 4.9.0.201705302345 SDK Ver: 6.2.0.v20170623140932, 6.1.1.v20170623141152 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.2 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1

JSON Source