更改应用程序名称和活动标签时 Android 的奇怪行为
我在 android 清单文件方面遇到了非常奇怪的问题。
我有这样的表现......
<application android:icon="@drawable/icon" android:label="TestApplication">
<activity android:name=".Test" android:label="Test" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
那么在这种情况下,我的应用程序的名称是“TestApplication”,它应该显示在带有图标的设备菜单上。 启动器活动的名称是“Test”,当应用程序启动时,它应该出现在标题栏上。
但问题是应用程序显示名称“Test”作为应用程序名称,菜单上带有图标......但它必须显示“TestApplication”,因为我已经设置了应用程序名称。
我很困惑,为什么它将启动器活动名称显示为应用程序名称,但我已明确指定应用程序名称......
请解决问题,
谢谢
Nikhil
I am facing very strange issue with android manifest file.
I have manifest something like this.....
<application android:icon="@drawable/icon" android:label="TestApplication">
<activity android:name=".Test" android:label="Test" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Then in that case the name of my application is "TestApplication" which should be appear on the device menu with icon.
The name of launcher activity is "Test" which should be appear on the Title Bar when application launches.
But the problem is the application is showing the name "Test" as application name with icon on menu.....but it must show "TestApplication" as i have set the application name.
I am so stuck that why it is showing the launcher activity name as application name however i have specified the application name explicitly.....
Please resolve the issue
Thanks
Nikhil
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是它应该如何工作的。如果您为启动活动指定标签,该标签将显示在图标下方。如果您不指定标签,则将使用应用程序名称。
如果您希望图标旁边的名称为 TestApplication,则必须从 Activity 中删除该标签。如果您希望标题为 Test,则需要创建一个 自定义标题栏.
This is how it is supposed to work. If you specify a label for your launch activity, that label will be displayed under the icon. If you do not specify a label, then the Application name will be used.
If you want the name next to the icon to be TestApplication then you must remove the label from the Activity. If you then want the title to be Test, you'll need to create a custom title bar.
如果 Intent 没有自己的名称,它将从父级继承 - 在本例中为 Activity。有关更多详细信息,请参阅此问题。
If Intent does not have its own name, it will be inherited from the parent - in this case Activity. For more details look at this question.