【问题标题】:Multiline window title in titanium钛金属多行窗口标题
【发布时间】:2016-11-21 15:25:18
【问题描述】:

我正在狂热地尝试将窗口的标题设为多行。 我有一个相当长的标题,需要能够看到整个标题。

现在标题只是被剪掉了,如果它比窗口允许的长,就会有三个点 但是如果太长,我需要它分成两行

我当前的标记看起来像:

/////// create first starting window ////////
var startWin = Titanium.UI.createWindow({
    title: 'Some really long title that has to be wrapped',
    navBarHidden: false,
    exitOnClose: true,
    barImage: '/images/header_background.png',
    titleAttributes: {
        color: '#FFF',
        font: {
            fontSize: 20,
            minFontSize: 15,
            fontWeight: 'bold',
            wordWrap: true
        }
    }
});

或者我可以使用多行标签吗?

谁有想法?

感谢

我的工作代码感谢塞巴斯蒂安

page_title = Ti.UI.createLabel({
    text: 'Algorithmen',
    height: 80,
    left: 60,
    right: 60,
    textAlign: 'center',
    color: '#fff',
    font: {
        fontSize: 18,
        fontWeight: 'bold',
        wordWrap: true
    }
}),
startWin = Titanium.UI.createWindow({
    titleControl: page_title,
    navBarHidden: false,
    exitOnClose: true,
    barImage: '/images/header_background.png'
});

【问题讨论】:

    标签: titanium titanium-mobile


    【解决方案1】:

    你可以给 window.titleControl 设置一个标签

    var startWin = Titanium.UI.createWindow({
      titleControl: Ti.UI.createLabel({
        text:'Some really long title that has to be wrapped'
        font:{
            fontSize: 20,
            minFontSize: 15,
            fontWeight: 'bold'
        }
      }),
      navBarHidden: false,
      exitOnClose: true,
      barImage: '/images/header_background.png',
    });
    

    【讨论】:

    • 完美!这允许我添加一个多行标签作为窗口的标题。非常感谢,我会将我的代码添加到我的答案中
    【解决方案2】:

    我从来没有做到这一点,所以我一直隐藏标题栏并创建了自己的标题栏,使用 android 你需要创建一个自定义主题来隐藏标题栏,iOS 上也没有标题栏。

    我主要使用合金并创建了一个导航控制视图,我通过引用每个页面添加了该视图,然后在其中设置标题和菜单选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-11
      • 1970-01-01
      相关资源
      最近更新 更多