style and theme
来源:互联网 发布:新丰网络问政首页 编辑:程序博客网 时间:2024/06/05 07:32
今天想写一些关于主题和样式的博客,以方便记录学习的过程和以后的应用
今天有个应用要把样式改成明亮的Holo.Light的样式
<activity
android:theme="@style/activity_theme" // 这句是定义activity的主题
android:name=".ItemsActivity"
android:label="@string/app_name" >
主题又在res文件下的styles.xml中定义
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="activity_theme" parent="@android:style/Theme.Holo.Light"> // 这行是定义style为明亮的主题
</style>
</resources>
如
前面是引子,现在系统的根据andorid documents来整理styles 和 theme:
一:简介
style 是根据web的设计哲学,把样式和内容分开
举个例子,layout可以这样
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#00FF00" android:typeface="monospace" android:text="@string/hello" />
或者是这样
<TextView style="@style/CodeFont" android:text="@string/hello" />
CodeFont在styles.xml中自己定义比如:
<?xml version="1.0" encoding="utf-8"?><resources> <style name="CodeFont" parent="@android:style/TextAppearance.Medium"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:textColor">#00FF00</item> <item name="android:typeface">monospace</item> </style></resources>
二:style的继承关系:
<style name="CodeFont.Red"> <item name="android:textColor">#FF0000</item> </style>这样CodeFont.Red就继承了CodeFont 并且加了颜色
三:style的属性:
<EditText android:inputType="number" ... />你可以把组件的属性设为是输入数字:
<style name="Numbers"> <item name="android:inputType">number</item> ...</style>在layout.xml中的EditText中就可以这样
<EditText style="@style/Numbers" ... />
0 0
- style and theme
- Android Theme and style
- Android Theme and style
- Android Theme and style
- Android Style and Theme
- Android style and theme 小结
- Android风格与主题( style and theme )
- android风格和主题:Style and Theme
- 样式和主题(Style and Theme)详解
- style theme
- style/theme
- theme & style
- Android风格与主题(style and theme)
- Android风格与主题(style and theme)
- Android风格与主题(style and theme)
- Android风格与主题(style and theme)
- 系统自带的主题与样式(theme and style)
- Android 风格与主题(style and theme)
- This Handler class should be static or leaks might occur Android (转)
- oralce导脚本
- 转载_linux od命令: 按不同进制显示文件
- 数据库集群(定义)
- 7.返回值为引用 和 8.静态对象的构造
- style and theme
- CMMI体系的责任归属
- 修改ipa
- WiFi基本知识
- aspx向silverlight传值
- linux下各种解包打包命令大全
- nrf24le1输出4K方波
- 黑马程序员_Java图形用户界面GUI
- 据说看懂这些故事的人 最后都成了亿万富翁