我正在制作一个日冕新游戏的登录页面。有两个字段(用户名和密码),在Android手机上加载应用程序后,我有同样的问题。
插入文本时,我无法看到显示在文本字段上部的字符。结果一切都不可读。
我使用了文本框hight = 60
和fontsize=20
。
尽管如此,文字在上半部分对齐,很难理解我在写什么......
任何帮助?
请在下面找到代码:
local function pswHandler( text2Field )
return function( event )
if ( "began" == 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 ( "ended" == event.phase ) then
-- This event is called when the user stops editing a field: for example, when they touch a different field
usrPsw=text2Field().text
elseif ( "editing" == event.phase ) then
elseif ( "submitted" == event.phase ) then
-- This event occurs when the user presses the "return" key (if available) on the onscreen keyboard
-- Hide keyboard
native.setKeyboardFocus( nil )
end
end
end
function login()
infoBox=display.newImage("settings.png")
infoBox.x=W
infoBox.y=H-35
transition.from(infoBox,{time=0,xScale=0.5,yScale=0.6,transition=easing.cutExpo})
usrfield = native.newTextField( 390, 350, 500, 60 )
usrfield.font = native.newFont(native.systemFont, 20 )
usrfield.inputType = "text"
usrfield.hasBackground=true
usrfield:setTextColor(0,0,0,255)
usrfield:addEventListener( "userInput", usrHandler( function() return usrfield end ) )
usrUsr=usrfield.text
avv1=display.newText("Username: ",140,290,"RepriseStamp",30)
avv1.anchorX=0
avv1:setTextColor(1,1,0,255)
pswfield = native.newTextField( 390, 500, 500, 60 )
pswfield.font = native.newFont( native.systemFont, 20 )
pswfield.inputType = "text"
pswfield.hasBackground=true
pswfield:setTextColor(0,0,0,255)
pswfield:addEventListener( "userInput", pswHandler( function() return pswfield end ) )
pswfield.isSecure=true
usrPsw=pswfield.text
avv2=display.newText("Password: ",140,440,"RepriseStamp",30)
avv2.anchorX=0
avv2:setTextColor(1,1,0,255)
nl1=display.newText("New? Click ",400,300,"RepriseStamp",40)
nl1:setTextColor(1,1,1,255)
nl1.x=W-50
nl1.y=150
local buttonOK1 = widget.newButton
{
id = "buttonOK1",
defaultFile = "buttonbn.png",
label = "OK",
labelColor =
{
default = { 0, 0, 0, 255 },
},
font = "RepriseStamp",
fontSize = 30,
emboss = true,
onEvent = connetti,
isEnabled=true
}
buttonOK1.x=490
buttonOK1.y=600
答案 0 :(得分:0)
获取稍后的每日构建并尝试一下。我们在上次公开构建之后优化了大小调整文本字段。