公共资源命名分析
带 * 代表重要成分
开头 *
为了区分公共资源和普通资源,同时也是为了方便代码中查看,以特定关键字开头如:hcb
资源分类(可选)
资源主要分为4种大类别,由于Android本身资源文件会有文件夹区分,可以省略。
- color 缩写cr
- dimens 缩写dm
- style 缩写st
- themes 缩写tm
使用分类 *
不同资源下可能存在不同使用场景的情况,例如dimens中可能包含:文字大小,内外边距,分割线宽度等等。
字体
- font 缩写fn
- margin 缩写ma
- divide 缩写dv
- Corner 缩写cn
颜色
- 品牌色 Visual Identity 缩写vi
- 辅助色 aid
- 中性色 neutral 缩写nt
使用场景
根据使用场景分类可以帮助在使用时快速定位到想要的模块,如:
文字
- title
- subtitle
- discription
- dialog
颜色
- common 缩写cm
- enterprise 缩写ep
特有关键字
每个资源特有关键字,以能直观识别出特定含义为准,如果没有或者不好表示就以1,2,3,4,5等自然数代表。
-
Common cm 通用
-
alt 备选
-
background bg底色
-
label 标签
,…
举个栗子
文字
-
hcb_font_title_1
-
hcb_font_title_2
-
hcb_font_title_3
-
hcb_font_subtitle_1
-
hcb_font_subtitle_2
-
hcb_font_subtitle_3
-
hcb_margin_1
-
hcb_margin_2
-
hcb_margin_3
-
hcb_divide_1
-
hcb_divide_2
-
hcb_divide_3
-
hcb_cn_lable
-
hcb_cn_cm
…
颜色
-
hcb_vi_cm
-
hcb_vi_cm_alt
-
hcb_vi_ep
-
hcb_vi_ep_alt
-
hcb_vi_energy
-
hcb_vi_etc
-
hcb_vi_finance
-
hcb_aid_1
-
hcb_aid_1_bg
-
hcb_aid_2
-
hcb_aid_2_bg
-
hcb_aid_3
-
hcb_aid_3_bg
-
hcb_nt_1
-
hcb_nt_2
-
hcb_nt_3
…