android中的syle和theme
来源:互联网 发布:优衣库网站的seo分析 编辑:程序博客网 时间:2024/05/16 12:59
1、Style 风格、样式,是针对View控件的,是一系列属性的集合,用于简化代码编写。是元素级别的属性设置
1)引入,例在layout中设置多个控件View1, View2, ... , Viewn
如果这些控件都有相同的某些属性值,如
android:textSize = 10sp;
android:background= "#ffffff";
android:textColor = "#000000";
android:layout_width = "200dp"
2)现在有n个控件,上述设置是不是要输入n次呢?而且修改、维护相当的不便、且容易出错。
3)引入style,让后让每个View引用此Style
在res\values文件下,创建Style的xml文件,此处命名为myStyle.xml
<resouces>
<style>
<item name="android:textSize">10sp</item>
<item name="android:background">#ffffff</item>
<item name="android:textColor ">#000000</item>
<item name="android:layout_width">200dp</item>
</style>
</resouces>
4)使用Style, style = " @style/myStyle "
2、Theme主题,用于设置应用程序或Activity的属性,是针对页面级别的。建立Theme设置的属性文档的方法与style相同。
1)自定义Theme,需要在xml文档中设置通用属性。此处和设置Style类似。
2)引用Theme,需要在应用程序描述AndroidManifest.xml中添加,
如: <application android:theme=" @style/CustomStyle ">
</application>
通过代码设置主题setTheme(android.R.style.CustomStyle);
必须在设置VIew之前,即在setContentView(xxxx)前。
- android中的syle和theme
- Android中的style和theme
- Android中的style和theme
- Android中的Theme和Style
- Android 中的Theme和Style
- Android中的style和theme
- Android中的主题(theme)和样式(style)
- Android中的style和theme的用法
- 说说Android中的style和theme
- Android中的Attr、Style和Theme详解
- Android 中的Theme和Style使用
- Android 中的style和Theme的使用
- android中的主题Theme
- android中的主题Theme
- Android中的主题(Theme)
- Android中的theme
- Android中的风格和主题(style和theme)
- android中的样式和主题(styles和theme)
- UNIX哲学之echo
- fmdb 的简单使用
- Crash: 处理UncaughtExcption,捕获未处理异常信息,界面友好提示用户
- BZOJ1900: Uva10601 Cubes
- 致首次创业者:如果做到了这三点,想不成功都难
- android中的syle和theme
- http session
- 进程间通信(IPC)方式
- C语言的利用
- Android-x86 项目简介
- android-Supporting Different Devices
- 父类和子类中存在同一个成员变量
- 欢迎使用CSDN-markdown编辑器
- 适配器模式与外观模式(heade first设计模式 读书笔记)