如何调整Titanium Label中的行间距

How to adjust line spacing in Titanium Label

是否可以在 Titanium 标签中指定换行文本的行间距?我看不到执行此操作的方法吗?

实现它的一种方法是在属性字符串中使用基线偏移:

var win = Ti.UI.createWindow();

var text = "The history of all hitherto existing society is the history of class struggles. Freeman and slave, patrician and plebeian, lord and serf, guild-master and journeyman, in a word, oppressor and oppressed, stood in constant opposition to one another, carried on an uninterrupted, now hidden, now open fight, a fight that each time ended, either in a revolutionary reconstitution of society at large, or in the common ruin of the contending classes.";

var attr = Ti.UI.iOS.createAttributedString({
    text: text,
    attributes: [
        {
            type: Ti.UI.iOS.ATTRIBUTE_BASELINE_OFFSET,
            value: 20,
            range: [0,250]
        }  
    ]
});

var label = Ti.UI.createLabel({
    attributedString: attr,
    color:'white',
    width:Ti.UI.FILL,
    height:500
});
win.add(label);

win.open();