android学习之-Style样式的定义
2011-12-15 19:11
477 查看
这个例子主要是写了配置文件,main.xml
定义要用到的样式style.xml
有没有发现style.xml的定义方式与color.xml很相似呢,引一下color.xml的定义
对比一下可以更深的加强记忆,其它的代码还是见附件
本文出自 “博客即日起停止更新” 博客,请务必保留此出处http://sucre.blog.51cto.com/1084905/742957
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/str_text_view1" style="@style/StyleText1" android:gravity="center_vertical|center_horizontal" /><!-- 水平垂直居中对齐 --> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/str_text_view2" style="@style/StyleText2" android:gravity="center_vertical|center_horizontal" /> </LinearLayout>
定义要用到的样式style.xml
<?xml version="1.0" encoding="UTF-8"?> <resources> <style name="StyleText1"> <item name="android:textSize">18sp</item> <item name="android:textColor">#EC9237</item> </style> <style name="StyleText2"> <item name="android:textSize">14sp</item> <item name="android:textColor">#FF7F7C</item> <item name="android:fromAlpha">0.0</item> <item name="android:toAlpha">0.0</item> </style> </resources>
有没有发现style.xml的定义方式与color.xml很相似呢,引一下color.xml的定义
<?xml version="1.0" encoding="UTF-8"?> <resources> <color name="white">#ffffff</color> <color name="black">#000000</color> <drawable name="red">#ff0000</drawable> <drawable name="blue">#0000ff</drawable> </resources>
对比一下可以更深的加强记忆,其它的代码还是见附件
本文出自 “博客即日起停止更新” 博客,请务必保留此出处http://sucre.blog.51cto.com/1084905/742957
相关文章推荐
- Android样式(style)和主题(theme)资源介绍-android学习之旅(五十六)
- Android学习第十六天----预定义样式
- WPF开发学习:资源在内外部定义的不同方式和怎么引用,Style样式的四种使用(对比CSS)
- Android样式(style)和主题(theme)资源介绍-android学习之旅(五十六)
- Android开发之style属性和预定义样式
- Android学习篇章16-Style控件样式的使用
- Android样式化的定型对象 — Style样式的定义
- Android学习之样式Style与主题theme
- Android开发之style属性和提前定义样式
- Android Style样式的定义和应用
- android中控件的style中主题样式定义
- Android的ProgressBar样式||||||style="?android:attr/progressBarStyleSmall"|||系统预置定义样式的用法是?android:attr/x
- Android Style Resource --- style样式的定义
- android UI学习 -- 设置界面的布局(包括style的使用,selector的使用,Checkbox自定义样式,菜单项的样式)
- Android样式化的定性对象--Style样式的定义
- android UI学习 -- 设置界面的布局(包括style的使用,selector的使用,Checkbox自定义样式,菜单项的样式)
- MonoDroid学习笔记(五)—— 更改TextView字体颜色和背景色及Style样式的定义
- Android样式(style)和主题(theme)资源介绍-android学习之旅(五十六)
- Android样式(style)和主题(theme)资源介绍-android学习之旅(五十六)
- Android style样式文件的使用