What's the “dot” for when registering an Activity

前端 未结 3 1398
温柔的废话
温柔的废话 2020-11-29 04:24

I\'m kind of a noob at programming for the Android OS. I noticed in the books I have been reading that the authors have placed a \"dot\" in front of the activity name when

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 04:53

    http://developer.android.com/guide/topics/manifest/activity-element.html#nm

    android:name
    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 .

    So given ApplicationManifest.xml:

    
        
            
            ...
        
     
    

    then since android:name=".view.TaskListListView" has a leading period, so it is interpreted as android:name="com.stackoverflow.android.geotask.view.TaskListListView".

提交回复
热议问题