Android应用开发中的风格和主题(style,themes)
来源:互联网 发布:c语言求两点间距离 编辑:程序博客网 时间:2024/05/18 08:17
- Theme是针对窗体级别的,改变窗体样式;
- Style是针对窗体元素级别的,改变指定控件或者Layout的样式。
Android系统的themes.xml和style.xml(位于\base\core\res\res\values\)包含了很多系统定义好的style,建议在里面挑个合适的,然后再继承修改。
以下属性是在Themes中比较常见的,源自Android系统本身的themes.xml:
<!-- Window attributes --> <item name="windowBackground">@android:drawable/screen_background_dark</item> <item name="windowFrame">@null</item> <item name="windowNoTitle">false</item> <item name="windowFullscreen">false</item> <item name="windowIsFloating">false</item> <item name="windowContentOverlay">@android:drawable/title_bar_shadow</item> <item name="windowTitleStyle">@android:style/WindowTitle</item> <item name="windowTitleSize">25dip</item> <item name="windowTitleBackgroundStyle">@android:style/WindowTitleBackground</item> <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
各种样式具体使用可看:http://henzil.easymorse.com/?p=364 android Theme使用总结
至于控件的Style设计就范围大多了,看看Eclipse的Android控件属性编辑器[Properties]就大概知道有哪些条目,而Android内置的style.xml也只是定义每个控件的默认样式而已....不过控件的style不建议大改,耐看的style更能让用户长时间使用软件。另外,控件的Style在很多情况下都用到9.png,学习9.png就必须到\base\core\res\res\drawable-hdpi里面看看,里面有很多系统内置的9.png。
<?xml version="1.0" encoding="utf-8"?><resources> <style name="SpecialText" parent="@style/Text"> <item name="android:textSize">18sp</item> <item name="android:textColor">#008</item> </style></resources>
<EditText id="@+id/text1" style="@style/SpecialText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Hello, World!" />
Theme:
<?xml version="1.0" encoding="utf-8"?><resources> <style name="CustomTheme"> <item name="android:windowNoTitle">true</item> <item name="windowFrame">@drawable/screen_frame</item> <item name="windowBackground">@drawable/screen_background_white</item> <item name="panelForegroundColor">#FF000000</item> <item name="panelBackgroundColor">#FFFFFFFF</item> <item name="panelTextColor">?panelForegroundColor</item> <item name="panelTextSize">14</item> <item name="menuItemTextColor">?panelTextColor</item> <item name="menuItemTextSize">?panelTextSize</item> </style></resources>
1.在manifest当中设置主题
<application android:theme="@style/CustomTheme">
<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
2.在程序当中设置主题
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... setTheme(android.R.style.Theme_Light); setContentView(R.layout.linear_layout_3);}
===============================================================================
案例可看:
1.http://wang-peng1.iteye.com/blog/561292 android之buttonBar的设计--style的引用
2.http://mycoding.iteye.com/blog/966726 Android 用style简化layout布局文件
转载自 山岭巨人 http://www.cnblogs.com/playing/archive/2011/04/01/2002469.html
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- Android应用开发中的风格和主题(style,themes)
- 深入了解JAVA可变长度的参数(Varargs)
- 分享Ipad和Iphone融合项目的工程结构
- 设置HTML span 的宽度
- 网站效果会影响网站权重吗?
- Amazon web Services(AWS)技术文档
- Android应用开发中的风格和主题(style,themes)
- 一个php从数据库取出的无限极递归多维数组
- 控制cpu占有率
- the simple principles of the communication
- 海明校验码
- sql 2008 清空日志问题
- IOS 操纵状态栏(status bar)
- 集团以网站群模式实现信息资源落地
- Lotus Domino Notes表单,页面,视图,文档,域之间的关系