amurcia
amurcia

Reputation: 791

Appcelerator - Android multiline label

I need, into a TableViewRow, to have a two lines label but the label only shows one line.

This is my code:

1. tss file

"#titulo[platform=android] ":{
    font:{fontSize:15},
    textAlign:'left',
    color: '#0a80b0',
    top: 2,
    left:45,
    height:40,
    ellipsize: true,
    wordWrap: false,
    lines: 2
}

2. js controller file

var labelWidth =  Titanium.Platform.displayCaps.platformWidth - 45 - 20;

$.titulo.setText(args.get('title'));
$.titulo.setWidth(labelWidth);

Thank you for advance.

Question in appcelerator Q&A: http://developer.appcelerator.com/question/183058/android--multiline-text-label-into-a-table-row

EDIT:

Now I have two lines, but the last word of my first line is cut...

enter image description here

Upvotes: 0

Views: 1328

Answers (2)

Fokke Zandbergen
Fokke Zandbergen

Reputation: 3866

Use this instead:

"#titulo[platform=android] ":{
    font:{fontSize:15},
    textAlign:'left',
    color: '#0a80b0',
    top: 2,
    left:45,
    height:40,
    // ellipsize: true,
    wordWrap: true,
    // lines: 2
}

This will make the text wrap as long as the height has room for it.

Upvotes: 3

Fokke Zandbergen
Fokke Zandbergen

Reputation: 3866

This is a new property in SDK 4.1.0.GA or later. Do you use that version or an older?

Upvotes: 0

Related Questions