Egret 配置主题

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/Fanstasic/article/details/102687215

详见官方文档:https://developer.egret.com/cn/article/index/id/511

1.创建EXML文件,

2.创建TS文件,

3.配置default.thm.json文件

4.注意类名要对应 ;

5.代码片段

// TypeScript file
module src{
    export class BG extends eui.Component implements eui.UIComponent {
    public lab_about: eui.Label;
    public constructor() {
        super();
    }
    protected partAdded(partName: string, instance: any): void {
        super.partAdded(partName, instance);
    }
    protected childrenCreated(): void {
        super.childrenCreated();
        this.lab_about.text = "9527";
        this.lab_about.visible = false;
        setTimeout(()=>{this.lab_about.visible = true;},1000);
    }
}
}
//EXML文件
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="BG" width="400" height="300" xmlns:e="http://ns.egret.com/eui">
    <e:Image source = "bg_jpg" left = "118" top = "5" anchorOffsetX="0" width="163.86" anchorOffsetY="0" height="290.85"/>
    <e:Label id = "lab_about" text = "" left = "0" top = "0" textColor="#000000" size="40"/>
</e:Skin>

方法2:直接创建EUI文件会自动配置default.thm.json文件

猜你喜欢

转载自blog.csdn.net/Fanstasic/article/details/102687215