zoukankan      html  css  js  c++  java
  • Styles和Themes

    通过指定Views的特性值,Style资源能够让应用程序保持一致的外观和感受。Sytles和Themes最常用的用途是储存应用程序的颜色和字体。
    你可以在manifest文件中,像theme一样,简单的指定不同的style来改变应用程序的外观。
    为了创建style,使用<style/>标签,包含一个name特性以及若干个item标签。每一个item标签需要有一个name特性来指明属性(如字体大小或颜色)。item标签中应包含值,如下面的框架代码所示:
    <?xml version=”1.0” encoding=”utf-8”?>
    <resources>
    <style name=”StyleName”>
    <item name=”attributeName”>value</item>
    </style>
    </resources>
    Sytles支持继承,通过在style标签里使用parent特性。
    接下来的例子给出了两个style,当然,也可以像theme一样使用。base style设置了文本的几个属性,而第二个style改变了base style中的字体大小。
    <?xml version=”1.0” encoding=”utf-8”?>
    <resources>
    <style name=”BaseText”>
    <item name=”android:textSize”>14sp</item>
    <item name=”android:textColor”>#111</item>
    </style>
    <style name=”SmallText” parent=”BaseText”>
    <item name=”android:textSize”>8sp</item>
    </style>
    </resources>
  • 相关阅读:
    O(n^2)的排序方法
    99乘法表
    excel 转 csv
    批量关闭 excel
    tomcat 加入服务
    文件打包 zip
    字符串转换
    List数组种删除数据
    mybatis 批量上传
    sql server 查询表字段及类型
  • 原文地址:https://www.cnblogs.com/top5/p/2439615.html
Copyright © 2011-2022 走看看