不同的启动器名称和标题名称
之前已经发布过类似的问题,但还没有令人满意的答案..问题很简单。我在我的应用程序中使用自定义标题栏(以包含文本的图像上的形式)。但是,当我使用启动器的标题(启动器图标下方的文本)时,它会自动设置活动标题的文本并将其显示在我的自定义标题栏下。如果我使用 setTitle("");在应用程序启动时删除标题文本,即使这样它也会显示一秒钟;足以引起注意,如果我完全删除标题栏文本,那么它也会删除启动器标题。清单文件中的 application_label 与启动器标题无关。启动器标题是从 Activity 标题中获取的,这对我来说很烦人。 有什么有用的建议吗??
A similar question has been posted before but no satisfying answers yet.. The question is simple. I am using a custom Title Bar in my application (in the form on an image having text). However, When I use a title for the Launcher (the text beneath the launcher icon), it automatically sets the text for activity title and displays it under my customized title bar. If I use setTitle(""); at the start of the application to remove the title text, even then it shows it for a second ; enough to be noticed and if I completely remove the title bar text then it also removes the launcher title as well.. The application_label in Manifest file has nothing to do with the launcher title. The launcher title is obtained from Activity title which is quite annoying for me..
Any useful suggestions??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道你有两个标题栏?一个是“来自 Android”,另一个是您的自定义栏?
您可以通过在清单中的相关活动中使用
android:theme="@android:style/Theme.NoTitleBar"
来隐藏 Android-bar。I understand you have two title bars? One 'from Android' and the other is your custom bar?
You can hide the Android-bar by using
android:theme="@android:style/Theme.NoTitleBar"
in the relevant activity in the manifest.您在调用
setContentView(R.layout.your_activity)
之前使用过setTitle("")
吗?如果是这样,它根本不应该显示清单中定义的文本,因为 setTitle() 方法调用应该在显示视图之前完成。我使用相同的方法来更改标题栏文本(并且仍然保留清单中定义的启动器文本)。我同意,奇怪的是,启动器文本不是基于
的 android:label 标签。不过,在 onCreate 中(在 setContentView() 之前)调用 setTitle() 的解决方法应该可以解决问题。Did you use
setTitle("")
BEFORE callingsetContentView(R.layout.your_activity)
? If so, it shouldn't show the text defined in your manifest at all because the setTitle() method call should have finished before the view is displayed. I use the same method to change the Title Bar text (and still maintain the Launcher text as defined in the manifest).I will agree that it's strange the Launcher text isn't based on the android:label tag of
<application>
. The workaround of calling setTitle() in onCreate (beforesetContentView()
) should do the trick though.