【问题标题】:How we can add Html Tags in Titanium iOS label我们如何在 Titanium iOS 标签中添加 Html 标签
【发布时间】:2016-06-26 07:13:06
【问题描述】:

我正在开发 Appcelerator 工作室。我想在标签文本中添加 html 标签。如何在标签中添加它。

var labThesisDetail = Titanium.UI.WebView({
        text : "<p><strong>Master Of Science in Land Resource Management</strong></p> <p> </p>",
        width : Ti.UI.FILL,
        height : Ti.UI.SIZE,
        right : 20,
        top : 20,
        editable : false,
        backgroundColor : 'white',
        left : 20,
        color : "black",
        font : {
            fontSize : 13,
            //fontFamily : "Signika-Regular",
            fontWeight : 'normal'
        }
    });
    viewCourseSummary.add(labThesisDetail);

【问题讨论】:

    标签: html ios titanium


    【解决方案1】:

    Android 只有一个 html 属性来执行此操作:http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Label-property-html

    如果你想要跨平台代码,你可以使用这个模块:http://gitt.io/component/ti.styledlabel(它比使用WebView更轻量级)

    var StyledLabel = require('ti.styledlabel');
    var label = StyledLabel.createLabel({
        height: Ti.UI.SIZE || 'auto',
        top: 5, right: 5, bottom: 5, left: 5,
        html: '<center>Loading, please wait.</center>'
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-21
      • 1970-01-01
      相关资源
      最近更新 更多