码迷,mamicode.com
首页 > 其他好文 > 详细

Egret之Label属性width与textWidth的区别

时间:2019-07-08 19:36:28      阅读:771      评论:0      收藏:0      [点我收藏+]

标签:child   class   component   port   区别   OLE   extend   ons   ret   

技术图片

一 : 此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}` );
    }
}
}

三 : 结果

技术图片
可知 : width / height 指的是蓝框

Egret之Label属性width与textWidth的区别

标签:child   class   component   port   区别   OLE   extend   ons   ret   

原文地址:https://blog.51cto.com/aonaufly/2418297

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!