有谁知道怎么做?我有这个代码:
var txtOne = Titanium.UI.createTextField({
top:50,
zIndex:1
});
var txtTwo = Titanium.UI.createTextField({
top:100
});
var txtThree = Titanium.UI.createTextField({
top:150,
zIndex:2
});
我想要的是从txtOne跳转到txtThree而不转到txtTwo ..
我尝试使用zIndex,但它对我不起作用..
任何想法?感谢
答案 0 :(得分:2)
你可以将它们放入一个数组中,并为它们的返回函数指定它们的事件处理程序,如下所示:
var textFields = [txtOne, txtTwo, txtThree];
for(vat i=0; i < textFields.length; i++)
{
//make the last text field jump to the first one when returning
if(i == textFields.length-1)
{
textFields [i].addEventListener('return', function(e)
{
textFields[0].focus();
});
}
else
{
//jump to the next text fields when returning
textFields [i].addEventListener('return', function(e)
{
textFields[i+1].focus();
});
}
}