zoukankan      html  css  js  c++  java
  • egret 示例实战七:富文本-实现文本内多种样式

    1.建立文本对象并初始化

    1         let txt:egret.TextField = new egret.TextField();
    2         txt.textColor = 0xffffff;
    3         txt.size = 24;
    4         txt.lineSpacing = 20;
    5         this.addChild(txt);
    6         txt.x = 30;
    7         txt.y = 100;

    2.设置文本的混合样式

     1       txt.textFlow = [
     2             {text: "一首告白小诗
    ", style: {"size": 40,textColor:0x000066}},
     3             {text:'作者:鲁米
    ',style:{"size":30,textColor:0xFF6666,fontFamily:"楷体",underline:true}},
     4             {text:'译者:梁永安
    ',style:{"size":25,textColor:0x33CC33,fontFamily:"微软雅黑"}},
     5             {text:'我们一生都在互望着对方的脸
    ',style:{"size":28,textColor:0x66CCFF}},
     6             {text:'今天也是如此。
    ',style:{"size":28}},
     7             {text:'我们是怎样守住这个',style:{"size":28,textColor:0x66CCFF}},
     8             {text:'爱',style:{"size":50,textColor:0xFF3300,strokeColor:0xFFFF66,stroke:2}},
     9             {text:'的秘密的呢?
    ',style:{"size":28,textColor:0x66CCFF}},
    10             {text:'我们以眉传话,
    ',style:{"size":28,textColor:0x99CC66,italic:true}},
    11             {text:'以眼聆听。
    ',style:{"size":30,textColor:0xFFCCCC,bold:true}},
    12         ];

    3.效果

  • 相关阅读:
    glibc源码下载
    指令查找工具
    ubuntu下ldd,查看程序动态库信息
    gdb使用记录
    找到返回地址(1)
    vim自动格式化
    android 注入so
    Mac下安装m2crypto 解决找不到openssl头文件的错误
    Mac下android studio卡,居然这么解决了。。。。
    git忽略文件
  • 原文地址:https://www.cnblogs.com/WentingC/p/9290416.html
Copyright © 2011-2022 走看看