Android:具有不同的标题名称和启动器名称
我有一个带有自定义标题栏的应用程序,其中我在图像中使用了标题背景或标题图像,并且删除了标题的字符串。
现在的问题是,如果我从标题中删除字符串,因为我使用自己的自定义标题栏,则我的应用程序没有启动器名称(显示在应用程序图标下方的名称)。
如果我为我的活动选择 noTitleBar,那么它也不会显示我的自定义标题栏。我不知道为什么 Android 从同一资源中获取标题和启动器的字符串......这样做没有意义。
这是我的自定义标题栏的代码
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TitlebarBackgroundStyle">
<item name="android:background">@drawable/titlebar</item>
</style>
<style name="Theme.MyCustomTheme" parent="android:Theme">
<item name="android:windowTitleBackgroundStyle">@style/TitlebarBackgroundStyle</item>
<item name="android:windowTitleSize">54dp</item>
</style>
有什么建议吗???
I have an application with a Custom Title Bar in which I have used in Image as the title background or title image and I have removed the string of the title.
Now the problem is that if I remove the string from the title since I am using my own customized titlebar, there is no launcher name for my application (the name that is displayed below the icon of your application).
If I select noTitleBar for my activity, then it won't show my customized titlebar as well. I don't know why Android takes the string for title and launcher from the same resource..it doesn't make sense to do so.
Here is my code of customized title bar
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TitlebarBackgroundStyle">
<item name="android:background">@drawable/titlebar</item>
</style>
<style name="Theme.MyCustomTheme" parent="android:Theme">
<item name="android:windowTitleBackgroundStyle">@style/TitlebarBackgroundStyle</item>
<item name="android:windowTitleSize">54dp</item>
</style>
Any suggestions???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为您的应用显示的应用程序名称在 Android 清单中的
标签中定义:如果您自己实现了
TitleBar
,您应该能够只需从布局中删除TextView
即可不在栏中打印此字符串(如您所愿)。但是,它需要设置,否则(正如您自己注意到的那样)应用程序在启动器中不会有名称。
The application-name that is shown for your app is defined in the Android Manifest in the
<application>
-tag:If you implemented a
TitleBar
yourself, you should be able to not print this string in the bar (as you want it) by simply removing theTextView
from the Layout.However it needs to be set, otherwise (as you noticed yourself) the app won't have a name in the launcher.