zoukankan      html  css  js  c++  java
  • UI库阶段性进展(完成textrender的文字align)

    不多说,上个图和xml说明问题:

    上图是5个按钮,文字分别使用了左对齐,上对齐,下对齐,右对齐,中对齐,具体看xml配置:

     1 <!--背景贴图的panel-->
     2 <style name="panel">
     3   <att name="bgmode" value="2"/>
     4   <att name="bgimg" value="panelbg.png"/>
     5   <att name="bgstretch" value="5,5,5,5"/>
     6   <att name="fcolor" value="FF000000"/>
     7 </style>
     8 <!--颜色背景的按钮-->
     9 <style name="btncolor1">
    10   <att name="bgmode" value="0"/>
    11   <att name="bgcolor" value="FFFF0000"/>
    12   <att name="bghovercolor" value="FF00FF00"/>
    13   <att name="txtalign" value="L|M"/>
    14 </style>
    15 <!--继承并且多了禁用属性的颜色按钮-->
    16 <style name="btncolor2" inherit="btncolor1"><!--注意可继承-->
    17   <att name="disable" value="1"/>
    18   <att name="txtalign" value="M|T"/><!--注意可以覆盖父亲的属性-->
    19 </style>
    20 <!--图片背景的按钮-->
    21 <style name="btnimg1">
    22   <att name="fcolor" value="FF00FF00"/>
    23   <att name="bgmode" value="1"/>
    24   <att name="bgimg" value="btnbg.png"/>
    25   <att name="txtalign" value="M|B"/>
    26 </style>
    27 <!--图片背景拉伸的按钮-->
    28 <style name="btnimg2">
    29   <att name="fcolor" value="FF00FF00"/>
    30   <att name="bgmode" value="2"/>
    31   <att name="bgimg" value="btnbg.png"/>
    32   <att name="bgstretch" value="5,5,5,5"/>
    33   <att name="txtalign" value="R|M"/>
    34 </style>
    35 <!--继承图片背景并且禁用的按钮-->
    36 <style name="btnimg3" inherit="btnimg2">
    37   <att name="disable" value="1"/>
    38   <att name="txtalign" value="M|M"/>
    39 </style>

    上图显示最后一个按钮在拉伸以后依然居中;

    刚刚又花了一个小时实现了文字的缩略显示:

  • 相关阅读:
    Centos系统下载
    Centos7 安装 docker
    Centos6 安装 docker
    yum提示Another app is currently holding the yum lock; waiting for it to exit...
    Oracle 时间字段显示不正确,类型错误
    Android 报错:error: too many padding sections on bottom border
    vs文件上传失败--超过最大字符限制
    ButterKnife 牛油刀使用
    VS项目发布到本地IIS
    Visual Studio无法调试
  • 原文地址:https://www.cnblogs.com/dwjaissk/p/2820133.html
Copyright © 2011-2022 走看看