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>
  • 相关阅读:
    个人工作总结07
    软件项目第一个Sprint评分
    丹佛机场行李系统没能及时交工的原因
    第一次团队冲刺 5
    第一次团队冲刺4
    第一次团队冲刺3
    第一次团队冲刺2
    第一次团队冲刺 1
    风险评估
    团队开发——第一篇scrum报告
  • 原文地址:https://www.cnblogs.com/top5/p/2439615.html
Copyright © 2011-2022 走看看