I want to add the second Activity and there are two formats. Are they both right?
我想添加第二个Activity,有两种格式。他们都是对的吗?
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecondActivity"
android:label="@string/app_name">
</application>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondActivity" >
</activity>
</application>
I am not sure what kind of format is ok and how many formats does it have to add an activity.
我不确定什么样的格式是好的,它有多少格式来添加活动。
1 个解决方案
#1
0
Both format is identical (if I except the label
). In the first you declare a new xml node with no children so it's closed directly at the end (don't forget /
) like this :
两种格式都相同(如果我除了标签)。在第一个你声明一个没有子节点的新xml节点,所以它最后直接关闭(不要忘记/)像这样:
<activity
android:name=".SecondActivity"
android:label="@string/app_name"/>
You could compare this with the img
tag in html <img src=""/>
您可以将其与html 中的img标记进行比较
#1
0
Both format is identical (if I except the label
). In the first you declare a new xml node with no children so it's closed directly at the end (don't forget /
) like this :
两种格式都相同(如果我除了标签)。在第一个你声明一个没有子节点的新xml节点,所以它最后直接关闭(不要忘记/)像这样:
<activity
android:name=".SecondActivity"
android:label="@string/app_name"/>
You could compare this with the img
tag in html <img src=""/>
您可以将其与html 中的img标记进行比较