請注意,默認大小應爲12px。這是關於DPI的嗎?怎麼解決?爲什麼我的TextField在定位Android時在屏幕上很小?
編輯
謝謝你這麼多,但是這並不接縫被什麼東西相關的字體大小。它看起來像它的東西有關處理DPI,因爲它與簡單Sprite
發生太小氣,和古怪的Android上接縫處的顏色使用倒轉的RGB序列
的Main.hx
:
package;
import openfl.display.DisplayObjectContainer;
import openfl.display.Sprite;
import openfl.display.StageAlign;
import openfl.display.StageScaleMode;
import openfl.events.Event;
import openfl.system.Capabilities;
import openfl.text.TextField;
import ru.stablex.ui.UIBuilder;
class Main extends Sprite
{
private var size: Float = 100;
private var r: Sprite;
private var g: Sprite;
private var b: Sprite;
public function new()
{
super();
addEventListener(Event.ADDED_TO_STAGE, addedToStage, false, 0, true);
}
private function addedToStage(event: Event): Void
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
r = createSquare(this, 0x00FF0000, size);
g = createSquare(this, 0x0000FF00, size);
b = createSquare(this, 0x000000FF, size);
stage.addEventListener(Event.RESIZE, resize, false, 0, true);
resize(null);
}
private function resize(event: Event): Void
{
r.x = 0;
r.y = 0;
g.x = (stage.stageWidth/2) - (size/2);
g.y = (stage.stageHeight/2) - (size/2);
b.x = stage.stageWidth - size;
b.y = stage.stageHeight - size;
}
private function createSquare(parent: DisplayObjectContainer, color: Int, size: Float): Sprite
{
var box: Sprite = new Sprite();
box.graphics.beginFill(color);
box.graphics.drawRect(0, 0, size, size);
box.graphics.endFill();
parent.addChild(box);
return box;
}
}
TextFieldAutoSize.CENTER。 –
http://help.adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#autoSize –