【问题标题】:Is it possible to strike-through a Label's text in Appcelerator?是否可以在 Appcelerator 中删除标签的文本?
【发布时间】:2016-01-15 10:17:24
【问题描述】:

是否可以在 Appcelerator 中对标签的文本应用删除线?如果有,怎么做?

【问题讨论】:

标签: appcelerator appcelerator-titanium


【解决方案1】:

您可以使用属性字符串,而不是使用标签。它提供了相当多的功能。

删除线的一个例子是这样的:

var attr = Ti.UI.createAttributedString({
    text: 'TEXT THAT NEEDS STRIKETHROUGH',
    attributes: [
        {
            type: Ti.UI.ATTRIBUTE_STRIKETHROUGH_STYLE,
            value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_THICK, // Ignored by Android only displays a single line
            range: [text.indexOf('hyperloop'), ('hyperloop').length]
        }
    ]
});

示例取自Attributed String Guide which is on the Appcelerator Documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-25
    • 2016-08-26
    • 1970-01-01
    • 2020-06-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多