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
代碼是更重要的一點。屏幕截圖只是爲了讓它完全清楚發生了什麼。 –