-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请教一下关于xml的命名规则 #55
Comments
这块内容我之前有在 QQ 群讲过的,我现在把聊天记录发给你看一下吧 |
小伙子,看完之后有啥疑问么 |
稍等,我这还看不到图片 |
看懂了,你是模块分类优先,我是以UI分类优先,我这种适合小项目,你这种可以通吃,感觉可以学一下你的命名了,谢谢大佬。 |
如果使用的databinding的不适合activity_main前面加上模块名字哦 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我在开发时Activity对应的XML命名一般都是与Activity类名打个颠倒。
比如类名叫SettingActivity,那么XML就叫activity_setting.xml,这样在layout文件夹里找XML文件时回很快。
但是看到作者demo里的命名是和类名顺序一致(setting_activity.xml),我想请教一下到底哪种命名规则是最规范或者最合理的?
这里也可以映射出类名的命名,比如一个增删改查的页面,之前我比较喜欢这样命名:
AddMsgActivity、DeleteMsgActivity、AmendMsgActivity、MsgListActivity、MsgDetailsActivity
后来就统一改成业务+功能的命名方式:
MsgAddActivity、MsgDeleteActivity、MsgAmendActivity、MsgListActivity、MsgDetailsActivity
这样看起来比较舒服,因为看你的代码写的很规范,所以我现在有点质疑我的写法了
The text was updated successfully, but these errors were encountered: