0

我是 Corona 的新手,并且遇到了 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
4

1 回答 1

0

试试这样...

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
于 2013-11-18T11:56:05.217 回答