我是科罗纳的新手,并且遇到 sqlite 和文本无法换行并显示在其他文本顶部的问题。 sqlite表引入了3列,分别是姓名,电话和评论。 注释列可能很长并且是换行的。 下面是我正在使用的代码。 任何想法将不胜感激。
--setting the font size & text display size
local fSize = display.contentWidth * .03
local tTab = display.contentWidth * .05
local tWidth = display.contentWidth * .9
local
tTop = display.contentHeight * .1
local count =0
local sql = "SELECT * from contacts"
for row i
n db:nrows(sql) do
if row.name == nil then
print(" NO NAME FOUND!!! ")
end
count = count +1
local dbText = row.name.." - "..row.phone.." - "..row.comment
local t = display.newText(dbText, tTab, tTop + ((fSize * 1.25) + (fSize * 1.25 *
count)), tWidth, 0, native.systemFont, fSize)
t:setTextColor(255,255,255)
end
试试这样...
local ypos= 50
for row in db:nrows(sql) do
if row.name == nil then
print(" NO NAME FOUND!!! ")
end
count = count +1
local dbText = row.name.." - "..row.phone.." - "..row.comment
local t = display.newText(dbText, tTab, ypos, tWidth, 0, native.systemFont, fSize)
ypos=t.y+ypos+30
t:setTextColor(255,255,255)
end