0

如何抵消钛中的标题控制?

现在我正在尝试在标题控件中的标签上放置一个 left: -100 属性,当您打开视图但随后它移回中心时有效。

关于如何实现这一转变有什么建议吗?

提前致谢!

var txtSearch = Titanium.UI.createTextField({
    hintText: 'Keyword to search for',
    height: 'auto',
    width: 220,
    left: -100,
    font: {fontSize: 12},
    enabled: true,
    keyboardType:Titanium.UI.KEYBOARD_EMAIL,  
    returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,  
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    autocapitalization: Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE,
    clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ONFOCUS
});
win.setTitleControl(txtSearch);

var btnSearch = Titanium.UI.createButton({
    title: 'Search',
    height: 'auto',
    width: 'auto',
    font: {fontSize: 13}
});
win.rightNavButton = btnSearch;

如果我点击搜索按钮,它把我带到搜索结果页面,然后我点击后退按钮,文本框不会移动并且看起来很好..只有当页面第一次加载时

4

1 回答 1

0

尝试将文本字段添加到视图,然后将视图设置为标题控件:

var container = Ti.UI.createView({
    width: 320
});

var txtSearch = Titanium.UI.createTextField({
    hintText: 'Keyword to search for',
    height: 'auto',
    width: 220,
    left: 0,
    font: {fontSize: 12},
    enabled: true,
    keyboardType:Titanium.UI.KEYBOARD_EMAIL,  
    returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,  
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    autocapitalization: Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE,
    clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ONFOCUS
});
container.add(txtSearch);
win.setTitleControl(container);
于 2013-04-09T13:15:53.817 回答