Android清单:为什么有时"<类名>"而不是仅仅与QUOT;<类名>"? [英] Android Manifest: Why sometimes ".<classname>" instead of just "<classname>"?

查看:144
本文介绍了Android清单:为什么有时"<类名>"而不是仅仅与QUOT;<类名>"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是点意味着什么?

大部分时间我只是写了:

most of the time I just write that:

<activity android:name="OneActivity" ...>...</activity>

但有时我在自动生成的文件中看到:

But sometimes I see in the autogenerated file:

<activity android:name=".OtherActivity" ...>...</activity>

和也是在文档的服务我看到他们写的

And also in the Docs for Service I see that they write

<manifest ... >
  ...
  <application ... >
      <service android:name=".ExampleService" />
      ...
  </application>
</manifest>

不过,我从来没有看到在尝试一个或其他任何差异。

But I never saw any differences in trying the one or the other.

推荐答案

从的的Andr​​oid开发指南&LT;活动>参考

这实现了活动,活动的一个子类的类的名字。该属性值应该是一个完全合格的类名(例如,com.example.project.ExtracurricularActivity)。然而,作为一个速记,如果名称的第一个字符是一个周期(例如,.ExtracurricularActivity)时,它被附加到在该元素中指定的包名。有
  没有默认值。该名称必须指定。

The name of the class that implements the activity, a subclass of Activity. The attribute value should be a fully qualified class name (such as, "com.example.project.ExtracurricularActivity"). However, as a shorthand, if the first character of the name is a period (for example, ".ExtracurricularActivity"), it is appended to the package name specified in the element. There is no default. The name must be specified.

信用:从活动名称jaywon在Android清单在堆栈溢出

这篇关于Android清单:为什么有时&QUOT;&LT;类名&GT;&QUOT;而不是仅仅与QUOT;&LT;类名&GT;&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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