<activity> vs. <activity/>. What is the difference?

This question already has an answer here:

  • What does <tag/> mean in XML? 1 answer
  • When are closing tags required with Android view markup? 3 answers

  • 第一种类型是简短的方式,除此之外没有什么区别,但是你可以这样做,因为如果你在活动中有额外的标签,你将使用第二种类型,就像你提到的那样,这取决于你是否觉得适合你


  • What are the main differences between the two, if any?

    No there is no difference between both of them both are valid

  • 1. The XML Schema of the AndroidManifest file allows empty-elements. An element with no content is said to be empty. The representation of an empty element is either a start-tag immediately followed by an end-tag

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

    2. when you need to supports nested inner tags in your <activity> tag than you should use for example

    <activity android:name=".Complaints"> 
            <intent-filter>
    
            </intent-filter>
       </activity>`
    
    链接地址: http://www.djcxy.com/p/23026.html

    上一篇: 9)在HTML输入框中使用jQuery?

    下一篇: <活动>与<活动/>。 有什么不同?