我想知道如何实现用户编写文本的“搜索栏”,此信息将在用户点击按钮搜索后发送,或按Enter键。
local campoBusqueda = native.newTextField( 50, 50, 300, 25 , onButtonRelease )
答案 0 :(得分:0)
这应该有所帮助:http://www.coronalabs.com/blog/2012/02/07/tutorial-text-input-with-native-ui/
信息将在提交的活动中提交。
答案 1 :(得分:0)
我正在为您提供我在代码中使用的代码,但您可以根据需要使用此代码 -
本地函数fieldHandler(事件)
if(“started”== event.phase)then
-- This is the "keyboard has appeared" event
-- In some cases you may want to adjust the interface when the keyboard appears.
elseif(“结束”== event.phase)然后
-- This event is called when the user stops editing a field: for example, when they touch a different field
elseif(“submit”== event.phase)然后
-- This event occurs when the user presses the "return" key (if available) on the onscreen keyboard
-- Hide keyboard
native.setKeyboardFocus( nil )
end
端
textField = native.newTextField(75,150,165,30,fieldHandler)
textField.font = native.newFont(native.systemFontBold,24)
textField.inputType =“名称”
组:插入(文本框)
我希望,它会帮助你......