我尝试了几种不同的东西。我得到了在表格视图中显示的文本字段(我想要一个文本字段表)但是当我输入时文本没有出现在字段中。键盘即将出现,可点击。不在表格视图中时,相同的文本字段效果很好。
textFields['user'] = Ti.UI.createTextField({
width:"100%", height:50,
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
});
....
var myRows = [];
var myRow = Titanium.UI.createTableViewRow({height:50, touchEnabled:false});
myRow.add(textFields['user']);
myRows.push(myRow);
tableview = Ti.UI.createTableView({
data: myRows
});
var view = Ti.UI.createView({top:10});
view.add(tableview);
serverInfoWinInstance.add(view);
我尝试将tableview直接添加到窗口,就像我通常那样,但同样的事情发生了。我正在使用Android,但我也希望这能在iPhone上运行。
答案 0 :(得分:0)
您没有构建文本字段值属性
textFields['user'] = Ti.UI.createTextField({
value : "", // need construct the value
width:"100%",
height:50,
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
});
或使用:
textFields['user'] = Ti.UI.createTextField({
hintText: 'Enter Name '
width:"100%",
height:50,
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
});
答案 1 :(得分:0)
我认为你的问题可能是你的表行有touchEnabled : false
,该表由该表的所有子元素继承。因此,当您将文本字段添加到表格行时,它们也会touchEnabled : false
。