object.hasBackground

类型 布尔值
对象 TextField
native.*
版本 版本 2024.3703
关键词 文本输入, 文本框, 原生文本
另请参阅 native.newTextBox()
native.newTextField()

概述

控制文本框是否具有不透明背景。默认为 true(不透明)。

注意事项

Win32 桌面应用程序或 Windows 版 Corona 模拟器不支持此属性。

示例

-- Draw red background
local rect = display.newRect( 0, 0, 320, 480 )
rect:setFillColor( 1, 0, 0 )

-- Text field with transparent background
local textField = native.newTextField( 30, 140, 260, 100 )
textField:setTextColor( 0.8, 0.8, 0.8 )
textField.hasBackground = false
textField.text = "Hello, world!"