【转】android中的Style与Theme
越来越多互联网企业都在Android平台上部署其客户端,为了提升用户体验,这些客户端都做得布局合理而且美观.......Android的Style设计就是提升用户体验的关键之一。Android上的Style分为了两个方面:
1,Theme是针对窗体级别的,改变窗体样式;
2,Style是针对窗体元素级别的,改变指定控件或者Layout的样式。
Android系统的themes.xml和style.xml(位于系统源代码frameworks\base\core\res\res\values\)包含了很多系统定义好的style,建议在里面挑个合适的,然后再继承修改。
代码片段(5)[全屏查看所有代码]
1. [图片] tu1.jpg

2. [图片] 效果图.gif

3. [代码]themes.xml
1
2
3
4
5
6
7
8
9
10
11
|
<!-- 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 > |
4. [代码]styles.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<? xml version = "1.0" encoding = "UTF-8" ?> < resources > < style name = "TextView" > < item name = "android:textSize" >18sp</ item > < item name = "android:textColor" >#008</ item > < item name = "android:shadowColor" >@android:color/black</ item > < item name = "android:shadowRadius" >2.0</ item > </ style > < style name = "EditText" > < item name = "android:shadowColor" >@android:color/black</ item > < item name = "android:shadowRadius" >1.0</ item > < item name = "android:background" >@android:drawable/btn_default</ item > < item name = "android:textAppearance" >?android:attr/textAppearanceMedium</ item > </ style > < style name = "Button" > < item name = "android:background" >@android:drawable/edit_text</ item > < item name = "android:textAppearance" >?android:attr/textAppearanceMedium</ item > </ style > </ resources > |
5. [代码]main.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<? 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/hello" style = "@style/TextView" /> < EditText android:id = "@+id/EditText01" android:layout_height = "wrap_content" style = "@style/EditText" android:layout_width = "fill_parent" android:text = "类似Button的EditText" ></ EditText > < EditText android:id = "@+id/EditText02" android:layout_height = "wrap_content" android:layout_width = "fill_parent" android:text = "普通的EditText" ></ EditText > < Button android:id = "@+id/Button01" android:layout_height = "wrap_content" style = "@style/Button" android:layout_width = "fill_parent" android:text = "类似EditText的Button" ></ Button > </ LinearLayout > |
【转】android中的Style与Theme的更多相关文章
- Android 中的style和Theme的使用
说明 style和theme的定义是为了改变原有系统设定的默认窗体.字体.背景色.格式等风格而使用.其本质就是系统属性的集合.本篇主要介绍android中的style和theme的具体用法. styl ...
- 【转】说说Android中的style和theme
最近在做软件从2.3到4.0的改变的一些工作,其中涉及了一些style和theme相关的东西.上网上查了一些东西,这个一并说说.关于android中style和theme的基本使用,这里就不再赘述了, ...
- Android中的 style 和 theme
通过设置 view 控件的属性,达到设置android UI的目的,如果某些 属性值复用率很高,可以考虑将属性单独声明在 style中,这样就可以达到复用的效果. 一.style Style 概念:A ...
- android中的style部分属性值介绍
转自:http://blog.sina.com.cn/s/blog_70c759fd01013phv.html Android平台定义的主题样式: android:theme="@andro ...
- android中的style部分属性值介绍 --zz
Android平台定义的主题样式: android:theme="@android:style/Theme.Dialog" 将一个Activity显示为对话框模式 •andro ...
- ArcGIS Runtime SDK for Android中SimpleFillSymbol.Style样式
SimpleFillSymbol.Style样式枚举共8种: 1.BACKWARD_DIAGONAL 反对角线填充 2.CROSS 交叉线填充 3.DIAGONAL_CROSS 前后对角线填充 4.F ...
- Android中Style和Theme的使用
Style: Style是View中一些属性的集合,包括height,padding,font color,background等等,Style单独定义在xml文件中,类似与web页面中css的角色, ...
- Android中theme.xml与style.xml的区别
一.相同点 两者的定义相同.继承方式也相同 <?xml version="1.0" encoding="utf-8"?> <resources ...
- Android中style和theme的区别
在学习Xamarin android的过程中,最先开始学习的还是熟练掌握android的六大布局-LinearLayout .RelativeLayout.TableLayout.FrameLayou ...
随机推荐
- docker 命令详解(cp篇)
docker cp :用于容器与主机之间的数据拷贝. 1.从容器里面拷文件到宿主机 答:在宿主机里面执行以下命令 docker cp 容器名:要拷贝的文件在容器里面的路径 要拷贝到宿主机的相应路径 ...
- 关于django2.0的外键关系新特性之on_delete!
Django2.0里model外键和一对一的on_delete参数 在django2.0后,定义外键和一对一关系的时候需要加on_delete选项,此参数为了避免两个表里的数据不一致问题,不然会报错: ...
- join合并字符串时使用生成器表达式
data=['11','pp','aa'] ','.join(str(d) for d in data)
- 性能测试工具Jmeter09-Jmeter参数化
三种方式: 1.用户参数 操作步骤,如下 响应断言,断言也要记得变量更替 2.CSV数据配置 以下截图为我的参数项文件 3.随机参数化
- android shape.xml 属性详解
转载源:http://blog.csdn.net/harvic880925/article/details/41850723 一.简单使用 刚开始,就先不讲一堆标签的意义及用法,先简单看看shape标 ...
- (转)shell中test命令方法详解
test命令用法.功能:检查文件和比较值 shell中test命令方法详解 原文:https://www.cnblogs.com/guanyf/p/7553940.html 1)判断表达式 if te ...
- LeetCode 881.救生艇(C++)
第 i 个人的体重为 people[i],每艘船可以承载的最大重量为 limit. 每艘船最多可同时载两人,但条件是这些人的重量之和最多为 limit. 返回载到每一个人所需的最小船数.(保证每个人都 ...
- POJ 3020——Antenna Placement——————【 最小路径覆盖、奇偶性建图】
Antenna Placement Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u S ...
- Java 利用poi读取excel
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.Inpu ...
- elasticsearch排序-----5
我们之前查询出的结果都会有一个_score分值表示列出结果与搜索结果的相关性,该值越高排序位置越靠前,es具体是如何计算该值的,我们认真来看看. 1.根据字段值排序 比如我们要查询/index5下su ...