团队-科学计算器-代码设计规范

1.代码布局设计

缩进

  1.Tab实现

  2.空格实现

字符串:

  1.单引号

  2.双引号

  3.避免反斜杠的出现。

2.资源Res

  1.按照类型,分为以下几种

    控件Id命名:控件缩写 _模块(module) _功能名(function)

  2.Color命名

Resources Type命名规则
color 组件名+具体作用名。例 R.color.button_text

  3.String命名

Resources Type命名规则
string 具体功能。 例 R.string.hello

  4.Drawable命名

Resources Type命名规则
launcher icon ic_launcher。例R.drawable.ic_launcher
normal icon ic_具体模块_功能。例R.drawable.ic_audio_pause
Toolbar icon ic_ab_功能名。例如ic_ab_search
selector selector_模块_功能名。例如 selector_login_button
shape shape_模块功能名状态。例如 R.drawable.shape_login_button_pressed ,R.drawable.shape_login_button_normal
 

  5.Layout命名 

类型命名规则
activity activity_模块名。例如 R.layout.activity_login
include layout_模块名_功能名。例如 @layout/layout_login_bottom
widget widget_模块_功能。例如 R.layout.widget_app_clock
list header header_模块_功能。例如 R.layout.header_main_top_ad
fragment fragment_模块名。例如 R.layout.fragment_login_layout_header
 

  6.Menu命名

Resources Type命名规则
menu menu_模块名。例如 menu_login

  7.Values命名

Resources Type命名规则
color 模块名_color。例如 material_design_color
dimens 模块名_dimens。例如 material_design_dimens
style 模块名_style。例如 material_design_style
themes 模块名_themes。例如 material_design_themes
原文地址:https://www.cnblogs.com/mjw970619/p/7609053.html