这两种设置android:name字段的方式有什么区别?
我看到了这两种类型,但不确定为什么要用这两种不同的方式编写
我经常看到的一种方式是(注意“和服务器”之间的“.”):
android:name=".Server"
没有额外“.”的另一种方式名字前:
android:name="Server"
示例 xml
<service
android:name=".Server"
android:icon="@drawable/ic_launcher"
android:label="audioservice"
android:process=":my_process" >
</service>
<activity android:name=".DBView">
<intent-filter >
<action android:name="com.example.test.DBVIEW"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
最佳答案
看this .
The name of the Service subclass that implements the service. This should be a fully qualified class name (such as, "com.example.project.RoomService"). However, as a shorthand, if the first character of the name is a period (for example, ".RoomService"), it is appended to the package name specified in the element.
关于android - android :name mean? 中的前导点是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14682382/