Android开发规范

为了规范开发,减小重构成本,总结编码规范如下,分享给大家,提供个参考

命名规范

  • 关于MVP

    对于MVP模式,由于需要实现众多的接口,导致代码臃肿,故决定采取Contract模式,即将接口统一放置在同一类中。

    e.g.

    特别注意:为了减少开发成本,请特别注意Contract内部类的命名,如确定此方案,则务必不要命名为NewsModel等形式

    对应实现类:

    特别注意:为了减少开发成本,请特别注意Presenter内部接口的命名,如确定此方案,则务必不要命名为NewsPresenterImpl等形式

    NewsPresenter

    NewsModel

    特别注意:明确区分ModelEntity 所有实体类放入Entity包,业务逻辑处理放入Model

  • 关于成员与变量

    1. 为了区分成员与local变量,采取与Android源码一致规范,即成员前加m。
    2. 静态常量命名需大写,且为final。

    e.g.

需要用作类似key判断的应写在静态常量里,切勿出现以下情况:

规范写法如下:

  • 关于Activity

    对于需要参数的Activity启动,统一提供静态方法,可以明确地通知调用者需要的参数,避免漏参情况。

    特别注意:为了减少开发成本,请注意方法命名,如确定此方案,则务必不要命名为startWebViewActivity()等形式

    e.g.

  • 关于fragment

    统一提供newInstance()方法返回实例.

    特别注意:为了减少开发成本,请注意方法命名,如确定此方案,则务必不要命名为newPlaceFragment()等形式

    e.g.

  • 关于布局文件

    1. 对于xml文件命名,前缀有layout、view、item、activity、fragment

    2. 对于id命名,有如下映射表,以此类推:

    控件名称 id命名
    TextView tv_sample
    RecyclerView rv_sample
    LinearLayout ll_sample
    RelativeLayout rl_sample

Android开发规范》有70个想法

  1. I just want to mention I am just new to blogging and site-building and certainly savored this website. Probably I’m likely to bookmark your blog post . You amazingly have wonderful stories. With thanks for revealing your web site.

  2. I just want to mention I am just new to blogging and site-building and certainly savored this website. Probably I’m likely to bookmark your blog post . You amazingly have wonderful stories. Omega replicaWith thanks for revealing your web site.

  3. I am writing to make you understand what a outstanding experience our daughter obtained browsing your blog. She came to understand numerous details, most notably what it is like to possess a marvelous helping mindset to let the rest smoothly learn about a number of complex issues. You truly did more than people’s expectations. Thank you for coming up with these great, trusted, revealing not to mention cool tips about the topic to Emily.

  4. I must show thanks to this writer for rescuing me from such a issue. Just after searching throughout the the net and meeting suggestions which were not pleasant, I figured my life was over. Being alive without the presence of solutions to the difficulties you’ve solved all through your good guideline is a serious case, and the ones which might have badly damaged my entire career if I hadn’t come across your website. Your actual training and kindness in handling everything was very useful. I’m not sure what I would have done if I had not encountered such a point like this. I am able to at this moment look forward to my future. Thanks a lot so much for the reliable and results-oriented help. I won’t be reluctant to endorse the blog to any individual who ought to have guidance on this subject.

  5. I am also writing to let you understand what a terrific encounter my wife’s child developed browsing the blog. She learned several things, which include what it is like to have a very effective teaching mood to have most people very easily have an understanding of several grueling topics. You really exceeded our expected results. Many thanks for imparting these warm and friendly, safe, explanatory and in addition easy tips about this topic to Kate.

  6. I抦 impressed, I must say. Really not often do I encounter a weblog that抯 each educative and entertaining, and let me inform you, you’ve got hit the nail on the head. Your thought is outstanding; the issue is one thing that not enough people are talking intelligently about. I am very completely happy that I stumbled across this in my seek for something relating to this.

  7. I wanted to jot down a simple word to be able to express gratitude to you for all of the splendid techniques you are posting at this website. My extended internet lookup has at the end of the day been rewarded with professional concept to go over with my colleagues. I ‘d assume that we site visitors are unquestionably fortunate to live in a great website with very many marvellous individuals with insightful hints. I feel extremely privileged to have encountered the website and look forward to really more thrilling minutes reading here. Thanks a lot once more for everything.

  8. I wanted to send you this little bit of word so as to thank you very much over again just for the pleasing techniques you have discussed here. It was so tremendously open-handed with you to deliver easily exactly what a lot of folks could have offered for sale as an e book to help with making some profit for their own end, principally given that you might have tried it if you wanted. Those tactics also acted like the fantastic way to comprehend some people have the same passion much like mine to see good deal more when it comes to this condition. I know there are numerous more fun opportunities up front for many who go through your blog.

  9. Awesome website you have here but I was wondering if you knew of any message boards that cover the same topics discussed in this article? I’d really love to be a part of online community where I can get suggestions from other experienced people that share the same interest. If you have any suggestions, please let me know. Thank you!

  10. I want to convey my respect for your kind-heartedness in support of men and women who really want help with this important niche. Your personal commitment to getting the solution up and down turned out to be remarkably helpful and have all the time permitted women like me to get to their aims. Your own informative hints and tips means a lot to me and further more to my fellow workers. Many thanks; from everyone of us.

  11. It really is suitable day to make some preparations for the long-run. I have go through this article and if I would, I wish to recommend you couple intriguing proposal.

  12. I merely need to inform you that I am new to blogging and completely enjoyed your report. Likely I am going to bookmark your blog post . You definitely have impressive article information. Admire it for discussing with us your main website document

  13. On Pixabay you will find both, terrific photos and cliparts. I would imagine several of these images are copyrighted and even though I probably bought some type of license once I bought the digital content I am not going to be sharing those files. It’s possible to even download whole size images without registration.

  14. I and also my guys ended up looking at the best tactics from your web page while all of a sudden I got a terrible feeling I had not thanked the web blog owner for them. My guys happened to be so joyful to learn all of them and have undoubtedly been making the most of them. I appreciate you for genuinely really helpful and also for finding variety of smart guides most people are really eager to discover. Our own sincere apologies for not saying thanks to you earlier.

  15. Hi folks here, just turned aware of your blog page through Yahoo and bing, and have found that it is truly educational. I’ll value in the event you keep up this post.

  16. I wanted to put you a tiny word so as to give thanks as before with your remarkable tactics you’ve documented on this page. It’s really extremely generous of people like you in giving without restraint precisely what a few people would’ve supplied for an electronic book to help make some profit on their own, and in particular considering that you might well have done it if you ever decided. The tactics as well acted to provide a fantastic way to fully grasp that some people have the same dream just like mine to realize very much more in respect of this issue. I am certain there are millions of more fun situations in the future for many who go through your website.

  17. I together with my guys appeared to be digesting the nice tips and hints located on the website and then immediately I got a horrible suspicion I never expressed respect to the website owner for those strategies. My ladies were totally very interested to learn them and have now simply been using these things. Thank you for turning out to be considerably thoughtful as well as for making a decision on such incredible information most people are really eager to be aware of. My personal sincere apologies for not saying thanks to you sooner.

  18. I needed to write you that very little observation so as to give thanks once again for all the incredible basics you’ve featured here. It’s pretty open-handed of you to present easily what exactly many of us would’ve offered for sale as an e book to generate some dough on their own, and in particular now that you might have done it if you decided. The tips additionally served to be a good way to be aware that most people have the identical interest like my very own to learn more in regard to this problem. I’m certain there are lots of more pleasant opportunities in the future for people who read through your site.

  19. I truly wanted to develop a brief word so as to express gratitude to you for the fabulous techniques you are giving at this site. My particularly long internet search has at the end of the day been paid with brilliant facts and strategies to talk about with my classmates and friends. I would point out that we website visitors are extremely lucky to exist in a fine website with very many awesome people with very beneficial techniques. I feel somewhat happy to have come across your weblog and look forward to some more pleasurable moments reading here. Thanks a lot again for all the details.

  20. A lot of thanks for all your valuable efforts on this site. My mother really likes making time for investigation and it’s obvious why. My spouse and i know all regarding the dynamic method you convey rewarding ideas on the blog and therefore boost contribution from some others about this concern plus our girl is certainly being taught a lot of things. Have fun with the remaining portion of the year. You are always doing a great job.

  21. My husband and i got lucky that Ervin could complete his reports via the ideas he was given when using the web page. It is now and again perplexing to simply possibly be giving away facts that other folks might have been making money from. Therefore we figure out we’ve got the website owner to be grateful to for that. All the illustrations you have made, the straightforward website navigation, the friendships your site give support to foster – it’s got many great, and it is helping our son and our family do think the theme is amusing, and that is wonderfully essential. Many thanks for all the pieces!

  22. I am just writing to make you know what a really good experience my wife’s daughter developed reading yuor web blog. She came to find a wide variety of details, which include what it is like to have an ideal giving heart to make the rest quite simply grasp selected advanced issues. You undoubtedly exceeded visitors’ expected results. Thanks for displaying the essential, dependable, revealing and even cool tips on that topic to Sandra.

  23. I really intend to inform you you that I am new to putting up a blog and really cherished your article. Most likely I am inclined to remember your blog post . You simply have stunning article material. Value it for swapping with us your own blog report

  24. I really intend to reveal to you that I am new to online blogging and incredibly cherished your site. Most likely I am likely to store your blog post . You simply have amazing article materials. Admire it for discussing with us your very own internet page

  25. Thank you, I’ve recently been looking for information approximately this subject for ages and yours is the best I have came upon till now. However, what in regards to the bottom line? Are you positive in regards to the supply?

  26. I as well as my friends were found to be going through the good helpful hints found on your website and then instantly I got a horrible feeling I had not expressed respect to the website owner for those techniques. These young boys appeared to be for this reason stimulated to learn all of them and now have definitely been taking advantage of those things. We appreciate you really being so kind as well as for figuring out some brilliant subject areas millions of individuals are really eager to learn about. My very own sincere regret for not saying thanks to you earlier.

  27. I am only writing to let you understand what a superb encounter my princess experienced going through your web page. She came to understand numerous things, which included what it is like to possess a wonderful giving spirit to get many people without hassle completely grasp various tricky issues. You actually did more than her expectations. Thanks for delivering the priceless, trustworthy, edifying not to mention unique tips on that topic to Gloria.

  28. I want to show some thanks to this writer just for bailing me out of this type of matter. As a result of checking throughout the internet and finding techniques that were not helpful, I believed my entire life was well over. Existing without the strategies to the issues you’ve solved as a result of your entire posting is a crucial case, as well as ones which might have in a wrong way affected my career if I hadn’t noticed your web page. The capability and kindness in playing with the whole lot was very helpful. I don’t know what I would’ve done if I had not come across such a thing like this. I can also at this time look ahead to my future. Thanks for your time very much for this high quality and sensible help. I won’t hesitate to propose your web page to anyone who wants and needs support on this subject matter.

  29. Hello There. I found your blog using msn. This is an extremely well written article. I’ll make sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will certainly comeback.

  30. I¡¦ve read several just right stuff here. Definitely price bookmarking for revisiting. I surprise how so much attempt you put to make this kind of fantastic informative web site.

  31. I want to express appreciation to the writer just for rescuing me from such a incident. Right after checking throughout the world wide web and meeting views which are not pleasant, I thought my entire life was well over. Existing without the approaches to the problems you’ve fixed all through your write-up is a crucial case, as well as the kind that could have badly damaged my career if I had not discovered the website. Your good knowledge and kindness in dealing with a lot of things was helpful. I’m not sure what I would have done if I had not come upon such a thing like this. I can also now look forward to my future. Thanks a lot very much for this expert and results-oriented guide. I will not hesitate to refer your web page to any individual who would need guidance about this area.

  32. I’m not sure where you’re getting your info, but great topic. I needs to spend some time learning much more or understanding more. Thanks for excellent information I was looking for this info for my mission.

  33. I’m not sure where you’re getting your info, but great topic. I needs to spend some time learning much more or understanding more. Thanks for excellent info I was looking for this info for my mission.

  34. Hello there, just became aware of your blog through Google, and found that it is truly informative. I’m gonna watch out for brussels. I’ll appreciate if you continue this in future. Lots of people will be benefited from your writing. Cheers!

  35. I am not sure where you’re getting your information, but great topic. I needs to spend some time learning much more or understanding more. Thanks for wonderful information I was looking for this info for my mission.

  36. It really is appropriate time to generate some preparations for the near future. I’ve scan this blog posting and if I can possibly, I want to propose you couple important instruction.

  37. Our experts have been actually reconsidering 2 of these for approximately 2 full weeks now, They are truly nice! I wish they keep their shape for many years as well as do not sag where the sleeper is located.

  38. I wanted to compose you that tiny note to finally thank you so much as before for all the spectacular methods you have documented on this website. It’s remarkably generous of you in giving openly all most of us would have made available as an e-book to generate some bucks for themselves, mostly now that you could possibly have done it in case you considered necessary. These techniques in addition worked to become a good way to recognize that the rest have a similar passion like my personal own to grasp a little more with regards to this condition. I believe there are some more pleasant periods up front for folks who take a look at your blog.

  39. Somebody essentially assist to make severely articles I would state. That is the first time I frequented your web page and to this point? I amazed with the research you made to create this actual post extraordinary. Excellent job!

发表评论

电子邮件地址不会被公开。