类型 字符串 对象 文本字段 库 native.* 修订 版本 2024.3703 关键词 native 文本输入 另请参见 native.newTextField()
Native 文本字段可显示可选占位符文本(默认值为 nil
)。这可作为用户应在字段中输入内容的“提示”。如果设置,则占位符字符串使用相同的样式信息(文本颜色除外)显示。一旦在字段中输入实际文本,占位符将不再显示,并且目前不参与确定文本字段的大小。
local numericField = native.newTextField( 150, 150, 220, 36 ) numericField.inputType = "number" -- Optional placeholder (hint) for the text field numericField.placeholder = "(phone number)" numericField:addEventListener( "userInput", handlerFunction )