[英]Is it possible to have multiple colors with a Titanium Appcelerator button bar? Titanium.UI.createButtonBar
This is my code thus far. 到目前为止,这是我的代码。 I have a button bar with two options.
我有一个带有两个选项的按钮栏。 I would like to change the color of the second option.
我想更改第二个选项的颜色。 I'm not quite sure how to accomplish this.
我不太确定如何做到这一点。 I was able to set up the click function by checking the index, but unsuccessful in trying to change the colors.
我可以通过检查索引来设置点击功能,但无法成功更改颜色。
var headerEmail = Titanium.UI.createButtonBar({
labels:['cory@gmail.com', 'Logout'],
backgroundColor:(labels[0] == 0) ? '#000' : '#fff'
});
headerEmail.addEventListener('click', function(e){
//alert(e.index);
if(e.index == 1){
var LoginWindow = require('/ui/LoginWindow')();
LoginWindow.open();
TabContainer.close();
}
});
Have tried with headerEmail.children[1], i mean you can try like this, 已经尝试使用headerEmail.children [1],我的意思是你可以这样尝试,
var headerEmail = Titanium.UI.createButtonBar({
labels:['cory@gmail.com', 'Logout'],
backgroundColor:(labels[0] == 0) ? '#000' : '#fff'
});
headerEmail.children[1].setbackgroundColor('#fff');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.