2015-08-24 39 views
0

我需要,到一個TableViewRow,有一個雙線標籤,但標籤只顯示一行。Appcelerator - Android多行標籤

這是我的代碼:

1 TSS文件

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

2. JS控制器文件

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

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

感謝您提前。

問題在Appcelerator的Q &答:http://developer.appcelerator.com/question/183058/android--multiline-text-label-into-a-table-row

編輯:

現在我有兩條線,但我的第一行的最後一個字被切斷......

enter image description here

回答

0

這是SDK 4.1.0.GA或更高版本中的一個新屬性。你使用那個版本還是更舊?

+0

不,我正在使用3.5.0.GA – amurcia

+0

在版本3.5.0.GA中,不可能在兩行中使用標籤?????? – amurcia

+0

我在版本4.1.0.GA嘗試,它不起作用 – amurcia

2

使用這個代替:

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

這將使文本換,只要高度有準備的房間。

+0

好吧,它有效,我有兩條線!但最後一個字是切... – amurcia

+0

然後它需要3行,你應該增加高度(或設置爲'Ti.UI.SIZE') –

+0

我想行,沒關係,但在第一個字行被剪切....對不起我的英語不好。 – amurcia