每一件事情都要从基础做起,其实理论知识真的很重要。 这里进行的事基础知识的总结: 在应用里面经常遇到统一样式格式的问题,那么与没有类似CSS的样式方法统一指定大小,颜色,选中效果等等 下面我们就进行统一设置样式:
在res/values下面创建一个style.xml
初始化创建内容是:
<?xml version="1.0" encoding="utf-8"?>
<resources> </resources> 下面是我们添加的两个简单样式设计,当然你也可以自己进行其他属性的设计: <?xml version="1.0" encoding="utf-8"?>
<resources> <style name="customStyle1"> <style name="customStyle2"> </resources>
在使用这些样式的方法: 比如:
<TextView
android:text="格式2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" style="@style/customStyle2"
/>
|
|
来自: Sunny_Gql > 《android 文章整理》