Android字体颜色统一化标准化。
在开发中往往有很多一样的代码,所以我们通常抽成一个公共类,以便复用,同样也是为了代码的简洁性。比如常量,我们会通常放到一个类里统一调用,还有utils、adapter等等。但是也有不少人会忽略字体和颜色的统一和标准。
1.字体(values目录下的dimens.xml文件中)
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<!-- 字体 -->
<dimen name="font_larger">22sp</dimen>
<dimen name="font_large">18sp</dimen>
<dimen name="font_normal">16sp</dimen>
<dimen name="font_small">14sp</dimen>
<dimen name="font_smaller">12sp</dimen>
<dimen name="font_smallest">10sp</dimen>
<!-- margin and padding -->
<dimen name="spacing_huge">40dp</dimen>
<dimen name="spacing_larger">34dp</dimen>
<dimen name="spacing_large">24dp</dimen>
<dimen name="spacing_biger">20dp</dimen>
<dimen name="spacing_big">18dp</dimen>
<dimen name="spacing_normal">14dp</dimen>
<dimen name="spacing_small">12dp</dimen>
<dimen name="spacing_smaller">10dp</dimen>
<dimen name="spacing_smallest">8dp</dimen>
<dimen name="spacing_tiny">6dp</dimen>
<dimen name="spacing_tinyer">4dp</dimen>
<dimen name="spacing_tinyest">2dp</dimen>
</resources>
2.颜色(values目录下的color.xml文件中)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--主题色-->
<color name="colorPrimary">#e55625</color>
<color name="colorPrimaryDark">#D54615</color>
<color name="colorAccent">#FF4081</color>
<color name="white">#ffffff</color>
<color name="black">#333333</color>
<color name="blue">#1C90DB</color>
<color name="green">#3BB032</color>
<color name="backGreen">#f3f6f5</color>
<color name="gray">#d3d3d3</color>
<color name="backGray">#eeeeee</color>
<color name="lightGray">#fafafa</color>
<!--字体的灰色-->
<color name="indexTextGray">#939393</color>
<color name="red">#e53935</color>
<color name="transparent">#00000000</color>
<color name="trantracent">#22000000</color>
<color name="trantracent_wode">#55000000</color>
<color name="grey_text_color_normal">#8A8A8A</color>
<color name="grey_line_bg">#E4E4E4</color>
<color name="original_border_color">#F18459</color>
</resources>
3.引用
字体:android:textSize="@dimen/font_small"
颜色:android:background="@color/white"
文章来源: blog.csdn.net,作者:yechaoa,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/yechaoa/article/details/58608116
- 点赞
- 收藏
- 关注作者
评论(0)