通过字符串、颜色和尺寸资源改变文字及样式
2016-01-10 17:35
701 查看
1、res\values目录下的strings.xml
2、res\values目录下的colors.xml
3、res\values目录下的dimen.xml尺寸资源
4、布局文件
<resources> <string name="app_name">Android8_1</string> <string name="title">英雄联盟</string> <string name="company">拳头公司</string> <string name="url">游戏网址:www.lol.com</string> <string name="introdce">《英雄联盟》(简称lol)是由美国Riot Games开发,腾讯游戏运营的英雄对战网游。《英雄联盟》除了即时战略、团队作战外,还拥有特色的英雄、自动匹配的战网平台,包括天赋树、召唤师系统、符文等元素。</string> </resources>
2、res\values目录下的colors.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="title">#ff0</color> <color name="company">#f70</color> <color name="url">#9f60</color> <color name="introduce">#7e8</color> </resources>
3、res\values目录下的dimen.xml尺寸资源
<?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="title">36px</dimen> <dimen name="padding">6pt</dimen> <dimen name="introduce">24px</dimen> <dimen name="titlePadding">20px</dimen> </resources>
4、布局文件
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="@dimen/padding" android:orientation="vertical" > <TextView android:text="@string/title" android:padding="@dimen/titlePadding" android:textSize="@dimen/title" android:textColor="@color/title" android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:textColor="@color/introduce" android:text="@string/introduce" android:textSize="@dimen/introduce" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:text="@string/company" android:gravity="center" android:textColor="@color/company" android:padding="@dimen/padding" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:text="@string/url" android:gravity="center" android:textColor="@color/url" android:paddingLeft="@dimen/padding" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout>
相关文章推荐
- 获取document对象除了getElement方法,居然还可以使用css选择器方法!!!
- CSS权威指南学习笔记(1)
- 简易在线投票系统(php)——前端设计(css)
- 利用css3伪类实现边框环绕效果
- css3制作立体导航
- 【CSS3】CSS3 滤镜实现
- 燕十八视频--CSS
- 燕十八---CSS画三角形
- css3实现图片旋转效果
- css中margin、padding等属性的简写方式解读
- 初学DIV+CSS需要注意的6个问题
- 如何书写可维护的CSS代码
- CSS代码书写顺序
- css中margin、padding等属性的简写方式解读
- 初学DIV+CSS需要注意的6个问题
- 如何书写可维护的CSS代码
- CSS代码书写顺序
- css display inline block 兼容性问题写法
- CSS 弹性布局如何实现
- 缩短浏览器上页面渲染