1

CoronaSDKに問題があります。newRectをnewTextFieldコントロールとオーバーラップさせたい。私のコード:

local localGroup = display.newGroup()

local txtOne = display.newTextField( display.contentWidth/2 - 140, 260, 280, 60)
 local txtTwo= display.newTextField( display.contentWidth/2 - 140, 360, 280, 60)
 local rect= display.newRect( display.contentWidth/2 - 140, 160, 200, 360)

localGroup:insert(txtOne)
 localGroup:insert(txtTwo)
 localGroup:insert(rect)

結果:txtOneとtxtTwoは常に私のrectオブジェクトとオーバーラップしています。しかし、rectオブジェクトをtxtOneとtxtTwoの上に配置したいと思います。これを行う方法はありますか?

4

2 に答える 2

0

According to the docs

Because native textfields are not part of the OpenGL canvas, they do not obey the Corona display object hierarchy. They always appear above normal display objects, and cannot be inserted into display groups.

So you can't bring the rect object in front.

You can work around it if you want. Just hide the textfield when not necessary

于 2012-08-15T00:15:20.510 に答える
-1

このリンクを読んでください。

試してください:rect:toFront()

テキストフィールドを作成するには、このリンクをお読みください。

于 2012-08-14T10:07:48.293 に答える