Egret之Label属性width与textWidth的区别

Egret之Label属性width与textWidth的区别

一 : 此Label的范围矩形框(蓝框)明显比文本实际占用的矩形(红框)要大

二 : 代码如下

module app{
    export class AAA extends eui.Component{
    private qqq : eui.Label = null;
    private mmm : eui.Label = null;
    public constructor(){
        super();
        this.skinName = "resource/eui_skins/aaa.exml";
    }

    protected childrenCreated() : void{
        super.childrenCreated();
        console.log( `width : ${this.qqq.width}` );
        console.log( `heigth : ${this.qqq.height}` );
        console.log( `textWidth : ${this.qqq.textWidth}` );
        console.log( `textHeigth : ${this.qqq.textHeight}` );
    }
}
}

三 : 结果

Egret之Label属性width与textWidth的区别
可知 : width / height 指的是蓝框

上一篇:python-字符串、列表、元祖之间的转换


下一篇:矩阵树定理的式子