开发者

Different Launcher Name and Title Name

开发者 https://www.devze.com 2023-03-14 15:02 出处:网络
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

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??


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.


Did you use setTitle("") BEFORE calling setContentView(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 (before setContentView()) should do the trick though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号