0
我正在制作corona新游戏的登录页面。有两个字段(用户名和密码)和两个我在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
这个问题的屏幕截图和实际的代码都可能在这里有帮助(对于熟悉'corona'的人来说可能更多)。 –
我稍后会发布。其实没什么可看的.Textfields显得非常空,只有文字的上半部分可以看到字符的下半部分......就像字体高度的10%! – ubaldo
代码是更重要的一点。屏幕截图只是为了让它完全清楚发生了什么。 –