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

    Styles and Themes

      A 样式 is a collection of properties that specify the look and format for a View or window. A style can specify properties such as height, padding, font color, font size, background color, and much more. A style is defined in an XML resource that is separate from the XML that specifies the layout.

      A theme is a style applied to an entire Activity or application, rather than an individual View (as in the example above). When a style is applied as a theme, every View in the Activity or application will apply each style property that it supports.

      To create a set of styles, save an XML file in the res/values/ directory of your project. The name of the XML file is arbitrary, but it must use the .xml extension and be saved in the res/values/ folder.

      The root node of the XML file must be <resources>.

      

      Each child of the <resources> element is converted into an application resource object at compile-time, which can be referenced by the value in the <style> element's name attribute. This example style can be referenced from an XML layout as @style/CodeFont

      If you want to inherit from styles that you've defined yourself, you do not have to use the parent attribute. Instead, just prefix the name of the style you want to inherit to the name of your new style, separated by a period. For example, to create a new style that inherits the CodeFont style defined above, but make the color red, you can author the new style like this:

      

    参考:http://www.android-doc.com/guide/topics/ui/themes.html

  • 相关阅读:
    【C/C++】动态内存分配和链表
    【C/C++】递归算法
    UnicodeMath编码教程
    UnicodeMath数学公式编码_翻译(Unicode Nearly Plain
    浅谈Java反射机制
    lvs--小白博客
    python部署lvs
    python部署galery集群
    python第九章:面向对象--小白博客
    python之yagmail模块--小白博客
  • 原文地址:https://www.cnblogs.com/tekkaman/p/6262514.html
Copyright © 2011-2022 走看看