Android的 - 包名称约定 [英] Android - Package Name convention

查看:87
本文介绍了Android的 - 包名称约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关在<一的Hello World的例子href="http://developer.android.com/resources/tutorials/hello-world.html">android.com,包的名称是包com.example.helloandroid;?,我想问的是有没有指引/标准来命名这个包,任何人都可以给我参考

For the "Hello World" example in android.com, the package name is "package com.example.helloandroid;", I want to ask is there any guideline/standard to name this package, could anyone give me reference?

感谢

推荐答案

Android的遵循正常的Java包约定加上这里是文本的一个重要片段阅读(关于在开发Android上广泛使用的XML文件,这一点很重要)。

Android follows normal java package conventions plus here is an important snippet of text to read (this is important regarding the wide use of xml files while developing on android).

的原因具有它以相反的顺序是做与存储介质上的布局。如果您考虑每一个周期('。')中的应用程序名称作为路径分隔符,从发布的所有应用程序将坐在一起的路径层次结构。 所以,举例来说,从Adobe包将是以下形式:

The reason for having it in reverse order is to do with the layout on the storage media. If you consider each period ('.') in the application name as a path separator, all applications from a publisher would sit together in the path hierarchy. So, for instance, packages from Adobe would be of the form:

com.adobe.reader(Adobe Reader的)

com.adobe.photoshop(Adobe公司的Photoshop)

com.adobe.ideas(的Adobe创意)

[注意,这仅仅是一个例子并且这些可能不是确切包名。]

[Note that this is just an illustration and these may not be the exact package names.]

这些可以从内部被映射(分别)为:

These could internally be mapped (respectively) to:

COM /土坯/阅读器

COM /土坯/ Photoshop中

COM /土坯/想法

这个概念来自于Java的包命名规则,更多的可以读取 位置:*

The concept comes from Package Naming Conventions in Java, more about which can be read here:*

<一个href="http://en.wikipedia.org/wiki/Java_package#Package_naming_conventions">http://en.wikipedia.org/wiki/Java_package#Package_naming_conventions

来源:<一href="http://www.quora.com/Why-do-a-majority-of-Android-package-names-begin-with-com">http://www.quora.com/Why-do-a-majority-of-Android-package-names-begin-with-com

这篇关于Android的 - 包名称约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆