使用Eclipse为Android定义style

时间:2023-03-08 23:23:28
使用Eclipse为Android定义style

1、首先,在values目录下,新建一个styles.xml文件:

使用Eclipse为Android定义style

2、进入styles.xml文件,点击Resources:使用Eclipse为Android定义style

3、点击Add按钮,在弹出的对话框中选择在顶层创建新元素,在选择Style/Theme,点击OK:使用Eclipse为Android定义style

4、选中新建的Style/Theme,输入名字my_style:使用Eclipse为Android定义style

5、选中my_style,点击Add:

使用Eclipse为Android定义style

6、双击Item,在Name中输入android:textSize,Value中输入25sp:使用Eclipse为Android定义style

7、按照同样方法,新建一个android:textStyle:

使用Eclipse为Android定义style

8、点击保存后,为TextView的Style属性选择my_style:

使用Eclipse为Android定义style

9、得到想要的结果,对其他控件同样适用:

使用Eclipse为Android定义style